Skip to content

Repository files navigation

Rusty Lip Gloss
crates.io Build Status coverage

Rusty Lip Gloss (rusty-lipgloss)

Rusty Lip Gloss is a complete, from-scratch Rust port of Lip Gloss, the styling library that powers Charmbracelet's terminal apps. It tracks upstream Go releases on a rolling basis under the family's porting policies: versions mirror upstream exactly, never ahead or behind, with a hard goal of 1:1 behavioural, visual and license parity, favouring fidelity to upstream semantics over Rust-native rewrites.

It's part of the Rusty port family of the Bubble Tea ecosystem and builds on rusty-ultraviolet (terminal renderer & input), rusty-x-ansi (ANSI primitives), and rusty-colorprofile — with UI components available in rusty-bubbles and the framework in rusty-bubbletea.

About Lip Gloss

Style, format and layout tools for terminal applications. Built for Rust based on upstream charmbracelet/lipgloss.

Lip Gloss Example

Overview

Rusty Lip Gloss gives you a small, fast, dependency-free toolkit for styling and laying out terminal output:

  • Styles — colors, bold/italic/underline, backgrounds, borders, margins, padding and alignment, all composed with a fluent builder API.
  • Text layout — width and height control, word wrapping, truncation, and horizontal/vertical alignment.
  • Composition — join strings horizontally or vertically, build tables, trees and lists, and render borders around any block.
  • Parity — every upstream Go test is ported 1:1, and the E2E harness verifies byte-for-byte output against charmbracelet/lipgloss.

Installation

cargo add rusty-lipgloss

Use the crate to style, format and lay out terminal text:

use rusty_lipgloss::new_style;
let styled = new_style().bold(true).foreground("63").render("hello");

rusty-lipgloss provides styling, layout, string joining, border rendering, tables, trees, and lists for terminal UI applications in lightweight, zero-unsafe, minimal-dependency Rust.

Principles

  1. Upstream Version Parity: Crate versions mirror the upstream Go releases on a 1:1 basis.
  2. Borrowing Discipline: Strongly prioritizes borrowing (&str, &[T]) over reference counting (Arc, Rc).
  3. Zero Unsafe: Enforced #![deny(unsafe_code)].
  4. 100% Test Parity: Complete 1:1 conversion of all upstream Go test cases to Rust tests/*.rs.

Usage Example

Style text, then compose it into larger layouts:

use rusty_lipgloss::{
    Border, Position, new_style, join_vertical, BOTTOM, CENTER, LEFT, RIGHT, TOP,
};

// A styled line of text.
let title = new_style()
    .bold(true)
    .foreground("#FF0000")
    .render("Hello Rusty Lipgloss!");

// A block with a border, padded and aligned.
let panel = new_style()
    .border(Border::rounded())
    .width(30)
    .height(5)
    .align(&[CENTER])
    .render("Centered inside a rounded border");

// Join blocks together.
let layout = join_vertical(TOP, &[title, panel]);
println!("{layout}");

Styles compose: set a background on one style and inherit it into another with inherit, render bordered tables with rusty_lipgloss::table, and lay out lists with rusty_lipgloss::list. See the examples directory for complete programs.

License

MIT

About

A port of Charmbracelet's 💄lipgloss to 🦀 Rust, including dependencies. Version and license matched to upstream.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages