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] holdsratatui::style::Colorvalues 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