Expand description
Semantic colour keys. Renderers look up named keys rather than hard-coding Color::Green,
so users can repaint the whole splash by overriding a handful of tokens in
[theme].
Shape of the contract:
ColorKeyis a static metadata record a renderer declares viaRenderer::color_keys. The xtask catalog picks those up so the docs page for every renderer lists the tokens it uses.Themeis the resolved palette passed to everyrender()call. Callers build it once fromThemeConfig(TOML) viaTheme::from_config.
§Default theme — “Splash”
Motif: sunrise over deep ocean. Every token is tuned so the palette reads like one
place rather than a grab-bag of accents. Two heroes anchor it — a warm coral for the
rising sun (panel_title, errors, hottest heatmap cell) and a cool cyan-teal for
sunlit shallows (accent_event, calendar markers). text_dim and text_secondary
lean teal so chrome feels like looking up through water. The palette_series cycle
stays on the coral↔ocean axis; palette_heatmap climbs night → shallow → sunrise →
dawn.
Token families follow a strict prefix scheme so TOML stays grep-able and new tokens slot into an obvious home:
bg/bg_subtle— painted surfaces.text/text_dim/text_secondary— body copy and its dimmer variants.panel_border/panel_title— panel chrome.status_ok/status_warn/status_error— badge triad.accent_today/accent_event— calendar / scatter markers.palette_series/palette_heatmap— multi-colour palettes.
Every token is opinionated — the splash owns the entire surface rather than leaking
terminal colours through unpainted cells. Users on light terminals (or anyone who’d
rather keep their terminal palette) can revert any token with [theme] <name> = "reset" — bg = "reset", text = "reset", etc. — which falls back to Color::Reset
for that slot only.
Modules§
- presets
- Built-in theme presets. Each function returns a fully-populated
Theme;[theme] preset = "name"selects one as the base, and any sibling keys in[theme]override individual tokens on top (seesuper::Theme::from_config).
Structs§
- Color
Key - Metadata describing one semantic colour token a renderer consumes. Lives next to the renderer’s declaration so it can’t drift out of sync with what the code actually reads. The xtask docs generator renders these into each renderer’s reference page.
- Theme
- Resolved palette handed to each
render()call. Immutable within a draw cycle. - Theme
Config - TOML representation of
[theme]. Every field optional — omitted keys fall back to the built-in default.ratatui::Colordeserializes from both named colours ("green","dark_gray") and"#RRGGBB"hex, so users don’t need to think about which form.
Constants§
- ACCENT_
EVENT - ACCENT_
TODAY - BG
- BG_
SUBTLE - PALETTE_
HEATMAP - PALETTE_
SERIES - PANEL_
BORDER - PANEL_
TITLE - STATUS_
ERROR - STATUS_
OK - STATUS_
WARN - TEXT
- TEXT_
DIM - TEXT_
SECONDARY
Functions§
- token_
color - Resolve a single-colour theme token by its TOML key (
"text","panel_title","status_ok"etc.). Used by renderers that accept acolor = "<token>"option; unknown names returnNoneso the caller can fall back to the renderer’s own default.