Skip to main content

Module theme

Module theme 

Source
Expand description

Centralized colour palette. Set once at startup from crate::config::UiConfig::theme; read by screens via active.

Themes are deliberately slot-based: each slot is a semantic intent (Pass / Warn / Fail / Header / etc.), not a literal colour. Components ask the active theme “what colour for Warn?” rather than hard-coding Color::Yellow — that’s what makes a mono variant possible without rewriting every component.

The migration is incremental: components flip from hard-coded Color literals to [active().pass] etc. as their commits land. The first migrated component (S1 Health) ships in the same commit as the theme module.

Structs§

Theme
Slot-based colour palette. New slots get added as components are migrated; never break a slot’s meaning between releases.

Functions§

active
Read the active theme. Returns the default palette if install was never called (e.g. in unit tests that don’t go through App::new).
from_name
Resolve a theme name to a Theme. Unknown names fall back to the default palette with a single tracing warning so the operator notices the typo without the binary refusing to start.
install
Set the active theme from the [ui] config section. Called once during crate::app::App::new. Re-calling silently no-ops; full runtime theme switching is a v0.6 feature.