gilt
Rich terminal formatting for Rust — a port of Python's rich library.
gilt brings beautiful terminal output to Rust with styles, tables, trees, syntax highlighting, progress bars, and more — all rendered as ANSI escape sequences.
Quick Start
[]
= "0.1"
use *;
Features
Core Widgets
- Text — Rich text with markup, styles, wrapping, alignment
- Table — Unicode box-drawing tables with column alignment and row striping
- Panel — Bordered content panels with titles
- Tree — Hierarchical tree display with guide lines
- Columns — Multi-column layout
- Layout — Flexible split-pane layouts
Terminal Features
- Syntax — Code highlighting via syntect (150+ languages)
- Markdown — Terminal-rendered Markdown
- JSON — Pretty-printed JSON with highlighting
- Progress — Multi-bar progress display with ETA, speed, spinner
- Live — Live-updating terminal display
- Status — Spinner with status message
Rust-Native Extensions
- Gradients — True-color RGB gradient text
- Stylize trait —
"hello".bold().red()method chaining - Iterator progress —
iter.progress()adapter #[derive(Table)]— Auto-generate tables from structs- Environment detection —
NO_COLOR,FORCE_COLOR,CLICOLORsupport - Inspect — Debug any value with rich formatting
- Extended underlines — Curly, dotted, dashed, double styles with color
- anstyle interop — Bidirectional conversion with
anstyletypes
Integrations
- miette — Diagnostic reporting with gilt styling
- eyre — Error reporting with gilt styling
- tracing — Log subscriber with colored output
- anstyle — Convert between gilt and anstyle
Color/Styletypes
Optional Features
[]
= { = "0.1", = ["tracing", "derive", "miette", "eyre", "anstyle"] }
| Feature | Description |
|---|---|
tracing |
tracing subscriber with gilt formatting |
derive |
#[derive(Table)] proc macro |
miette |
miette::ReportHandler implementation |
eyre |
eyre::EyreHandler implementation |
anstyle |
Bidirectional From conversions with anstyle types |
Examples
# Basic examples
# Rust-native features
# Feature-gated examples
See the examples/ directory for all 51 examples.
Global Console
// Print with markup
print_text;
// Print JSON
print_json;
// Inspect any Debug value
inspect;
License
MIT