gilt 0.2.0

A fast, rich terminal formatting library — Rust port of Python's rich
Documentation

gilt

Rich terminal formatting for Rust — a port of Python's rich library.

CI Crates.io Documentation License: MIT

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

[dependencies]
gilt = "0.1"
use gilt::prelude::*;

fn main() {
    let mut console = Console::new();
    console.print_text("Hello, [bold magenta]gilt[/bold magenta]!");
}

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 progressiter.progress() adapter
  • #[derive(Table)] — Auto-generate tables from structs
  • Environment detectionNO_COLOR, FORCE_COLOR, CLICOLOR support
  • Inspect — Debug any value with rich formatting
  • Extended underlines — Curly, dotted, dashed, double styles with color
  • anstyle interop — Bidirectional conversion with anstyle types

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/Style types

Optional Features

[dependencies]
gilt = { version = "0.1", features = ["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
cargo run --example table
cargo run --example panel
cargo run --example syntax
cargo run --example progress
cargo run --example markdown

# Rust-native features
cargo run --example gradient
cargo run --example inspect_demo
cargo run --example styled_string

# Feature-gated examples
cargo run --example derive_table --features derive
cargo run --example miette_demo --features miette
cargo run --example tracing_demo --features tracing

See the examples/ directory for all 51 examples.

Global Console

// Print with markup
gilt::print_text("Hello, [bold]world[/bold]!");

// Print JSON
gilt::print_json(r#"{"name": "gilt"}"#);

// Inspect any Debug value
gilt::inspect(&vec![1, 2, 3]);

License

MIT