What is Lacquer?
Lacquer is the Rust equivalent of lipgloss from Charmbracelet. It provides declarative style definitions for building beautiful terminal layoutsโwith padding, margins, borders, colors, and alignment.
use ;
let style = new
.padding
.margin
.border
.border_foreground
.foreground
.bold
.align;
println!;
โญโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ ๐ฅ Molten Labs โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโฏ
Features
๐ฆ Box Model
- Padding (all sides or individual)
- Margins (all sides or individual)
- Width/height constraints
- Max width/height limits
๐จ Colors & Styling
- Foreground & background colors
- Full RGB/hex color support
- Bold, italic, underline, dim
- Strikethrough, reverse video
๐ฒ Borders
- 8 built-in styles (Rounded, Double, Thick...)
- Custom border characters
- Per-side border colors
- ASCII fallback option
๐ Layout & Alignment
- Horizontal alignment (left, center, right)
- Vertical alignment (top, center, bottom)
- Inline mode for no-wrap rendering
- Unicode-aware width calculation
Installation
Or add to your Cargo.toml:
[]
= "0.1"
Quick Start
Basic Styling
use ;
// Simple colored text
let styled = new
.foreground
.bold
.render;
println!;
Box with Padding
use ;
let box_style = new
.padding // 1 vertical, 3 horizontal
.border
.render;
println!;
// โญโโโโโโโโโโโโโโฎ
// โ โ
// โ Content โ
// โ โ
// โฐโโโโโโโโโโโโโโฏ
Centered Content
use ;
let centered = new
.width
.border
.align
.render;
println!;
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
// โ Centered! โ
// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Multiple Lines
use ;
let content = "Line 1\nLine 2\nLine 3";
let multiline = new
.padding
.border
.foreground
.render;
println!;
Border Styles
use Border;
None // No border
Normal // โโโโ โ โโโโ
Rounded // โญโโโฎ โ โฐโโโฏ
Thick // โโโโ โ โโโโ
Double // โโโโ โ โโโโ
Ascii // +--+ | +--+
Block // โโโโ โ โโโโ
Dashed // โโโโ โ โโโโ
Custom Borders
use ;
let custom = Custom;
Inline Mode
For styling without block rendering (no borders, no padding):
use ;
let inline = new
.foreground
.bold
.inline
.render;
println!;
// Status: Error! (styled red and bold)
Using with Molten Brand
Enable the brand feature for pre-defined colors:
[]
= { = "0.1", = ["brand"] }
use ;
use ;
let goblin_box = new
.border
.border_foreground
.foreground
.render;
Why "Lacquer"?
In the forge, lacquer is the hard, protective finish applied to metalworkโtransforming raw iron into polished, beautiful artifacts. This library does the same for your terminal output. ๐
Ecosystem
Lacquer is part of the Molten Labs open source ecosystem:
| Crate | Description | Status |
|---|---|---|
| molten_brand | Design tokens & colors | โ Published |
| glyphs | ANSI escape sequences | โ Published |
| lacquer | Terminal styling (you are here) | โ Published |
| cauldron | TUI framework (like bubbletea) | ๐ Planned |
Documentation
- ๐ API Documentation
- ๐ก Examples
- ๐จ Molten Brand Colors
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.