gilt
Rich terminal output for Rust — a port of Python's rich, plus Rust-native extras: a compile-time text! macro, a WASM-safe build, lock-free async Live, inline images, asciinema export, and 7 widget derives.
What gilt is — and is not
gilt emits scrolling, styled ANSI output (styles, tables, trees, syntax,
markdown, progress bars, live displays) that drops straight into any CLI. You
print renderables and they scroll by just like normal terminal output.
gilt is not a full-screen TUI framework — it does not own the alternate
screen, run an event loop, or need crossterm for basic output. Reach for
ratatui when you need a full-screen
interactive app; reach for gilt for CLI output, log styling, CI reports, build
dashboards, and streaming output.
Quick start
[]
= "2.0"
use Console;
Upgrading? See MIGRATION_v2.md for the 1.x → 2.0 changes (and MIGRATION_v1.md for 0.13 → 1.0).
Visual gallery
Every image below is produced by gilt's own SVG export
(cargo run --example gen_readme_demos --all-features) and committed, so it
renders on GitHub and docs.rs without a server.
Styles — markup, named + true colour, backgrounds, hyperlinks:
Table — Unicode box-drawing with styled headers and inline markup:
Tree — hierarchies with configurable guide characters:
Markdown — headings, lists, inline + fenced code:
Syntax — 150+ languages with line numbers:
Progress — multi-bar with description, bar, percent, and ETA:
Rust-native extras — gradient text and sparklines:
gilt-cli — rich output without Rust
Install the binary to use gilt from shell scripts, Makefiles, and CI:
|
|
Full subcommand reference: crates/gilt-cli/.
Features
- Core widgets —
Text·Table·Panel·Tree·Columns·Layout·Padding·Align·Group. In 2.0 every container holds anyRenderable, so they nest freely (aPanelof aTable, aTreelabel that is aPanel, a table cell holding aPanel). - Terminal features —
Syntax(150+ languages) ·Markdown·Json·Progress(ETA, speed, spinner) ·Live(lock-free in-place updates) ·Status. - Rust-native extras —
Gradient·Sparkline·Canvas(Braille) ·Diff(unified + side-by-side) ·Figlet·CsvTable·Stylize("hi".bold().red()) · iterator.progress()·Inspect(anyDebug) · environment detection · WCAG 2.1 contrast · extended underlines · bidirectionalanstyleinterop. - Derive macros (feature
derive) —Table,Panel,Tree,Columns,Rule,Inspect,Renderable, plus the compile-timetext!macro that validates markup at compile time. Seecrates/gilt-derive/. - Optional integrations —
miette·eyre·tracing·anstyle.
Why gilt?
| gilt | rich (Python) | ratatui | Spectre.Console | |
|---|---|---|---|---|
| Language | Rust | Python | Rust | C# |
| Inline scrolling output | yes | yes | no | yes |
| Full-screen TUI | no | no | yes | no |
Compile-time text! macro |
yes | no | no | no |
| WASM-safe | yes | no | no | no |
| Derive macros | yes | no | no | partial |
| Inline images / asciinema export | yes | partial | no | no |
gilt is the natural choice for rich-style inline output in a Rust CLI or library — especially when WASM portability, dependency minimisation, or compile-time macros matter.
Documentation
| Resource | Where |
|---|---|
| API docs | docs.rs/gilt |
| Release notes | CHANGELOG.md |
| Migration guides | v2 · v1 |
| Live & streaming | docs/live-and-streaming.md |
| Derive macros | crates/gilt-derive/ |
| Examples | examples/ — cargo run --example <name> |
| Feature flags | docs.rs/crate/gilt/latest/features |
WebAssembly · Unicode · performance
- WebAssembly — compiles for
wasm32-unknown-unknownwithdefault-features = false(nolibc,crossterm, or terminal syscalls). The intended path is record-mode + export with an explicit width:
See= { = "2.0", = false, = ["json", "markdown", "syntax"] }examples/wasm_export.rs. - Unicode — visible width via
unicode-widthand grapheme iteration (UAX #29) viaunicode-segmentation. CJK fullwidth, single-codepoint / ZWJ / flag emoji, variation selectors, and combining marks are width-correct and never split mid-cluster; truncation snaps to cluster boundaries. Out of scope: bidi/RTL, NFC/NFD normalisation, vertical layout. - Performance —
cargo benchruns ~80 criterion benchmarks. See CHANGELOG.md for the v0.11 perf pass (lock-freeLive, −46% table render, …).
MSRV & license
MSRV 1.82.0 (for std::sync::LazyLock). Licensed MIT — see LICENSE.