Skip to content

Playbooks for g

Story-style workflows—solo, team, and on-call. Jump into the full Use cases page anytime.

ui::theme

Theme system — semantic palette, icons, spacing, borders and component

auto-generated This page is built from //! comments in the Rust source. Edit the source and run npm run docs:extract to update it.

Theme system — semantic palette, icons, spacing, borders and component styles, all assembled into a single [Theme] read from theme::current().

Folder layout

theme/
  mod.rs       ← this file: the Theme struct + current()/init() globals
  palette.rs   ← Palette (semantic role colors) + Palette::base()
  icons.rs     ← Icons (Unicode / ASCII fallbacks)
  spacing.rs   ← Spacing (density-driven indent / gaps)
  borders.rs   ← BorderStyle preset enum + Borders glyph set
  styles.rs    ← StyleSpec + Styles (named component presets)
  file.rs      ← built-in TOMLs + custom file loader + parse_color

Design

  • [Palette] holds ratatui::style::Color values mapped to semantic roles (primary, success, …) rather than raw color names.
  • [Icons] holds the Unicode strings used for status indicators (with an ASCII fallback for dumb terminals).
  • The global [current()] accessor uses a [std::sync::OnceLock] so the theme is initialised exactly once and every subsequent call is a zero-cost pointer dereference.

Source: src/ui/theme/mod.rs