mod theme

module theme

Shared ratatui theme module — the CLI/TUI half of the cross-surface token system defined in docs/design/system.md.

Every color, spacing step, and status glyph the TUI renders traces back to a named token in docs/design/system.md §1-§5. Both tui.rs (the generator/audit TUI) and vault_tui.rs (the vault TUI) import from this module instead of defining their own Color constants — consolidating what were previously two duplicated (and, in tui.rs’s case, one off-palette) const blocks per docs/design/system.md §7.

Naming mirrors the token table exactly: color.bg.base -> BG_BASE, color.status.verified -> STATUS_VERIFIED, and so on. Short aliases (BG, PANEL, TEXT, GREEN, BLUE, AMBER, RED) are kept so the existing call sites across both TUIs did not need to churn their bare identifiers; new code should prefer the intent-named constants.

docs/design/system.md §7 flags a PURPLE = #a78bfa constant in the old tui.rs const block as off-palette — it maps to no token meaning and is deliberately not carried forward here.

Variables

const ACCENT_ACTION: Color

color.accent.action — the one next thing to do. One per screen.

const AMBER: Color
const ANSI_ACCENT_ACTION: Color

color.accent.action 16-ANSI fallback — bright-blue (12).

const ANSI_STATUS_CAUTION: Color

color.status.caution 16-ANSI fallback — yellow (3).

const ANSI_STATUS_DANGER: Color

color.status.danger 16-ANSI fallback — red (1).

const ANSI_STATUS_VERIFIED: Color

color.status.verified 16-ANSI fallback — green (2).

const ANSI_TEXT_MUTED: Color

color.text.muted 16-ANSI fallback — bright-black (8).

const BG: Color
const BG_BASE: Color

color.bg.base — the ground. Near-black, low-glare; the whole surface.

const BG_PANEL: Color

color.bg.panel — a raised panel or focused region.

const BLUE: Color
const BORDER: Color

color.border — structure and separation between regions.

const GREEN: Color
const ICON_ACTION: &str

the one next action.

const ICON_CAUTION: &str

! attention / unverified.

const ICON_DANGER: &str

failed / danger.

const ICON_DRILL_DOWN: &str

drill into evidence / progressive disclosure.

const ICON_LOCKED: &str

locked — pairs with color.text.muted, never danger red (a locked vault is the safe state, not a failure).

const ICON_VERIFIED: &str

verified / passed.

const PANEL: Color
const RED: Color
const SPACE_BASE: u16

space.base — between groups; default panel padding.

const SPACE_LOOSE: u16

space.loose — between major regions; around the primary action.

const SPACE_SNUG: u16

space.snug — between stacked lines in a group.

const SPACE_TIGHT: u16

space.tight — between a label and its value; intra-row.

const STATUS_CAUTION: Color

color.status.caution — attention / unverified / in-between.

const STATUS_DANGER: Color

color.status.danger — danger / failure / irreversible. A stop, never decoration.

const STATUS_VERIFIED: Color

color.status.verified — verified / safe / passed. Earned only after a real check; never a default “all fine” wash.

const TEXT: Color
const TEXT_MUTED: Color

color.text.muted — secondary text, labels, footer keys, hints.

const TEXT_PRIMARY: Color

color.text.primary — primary reading text.

const TYPE_BODY: Modifier

type.body — primary content and reading text (no modifier).

const TYPE_LABEL: Modifier

type.label — field labels, footer keys, hints.

const TYPE_MONO: Modifier

type.mono — secrets, hashes, phrases, generated passwords. The terminal’s cell font is implicitly monospace; no modifier is needed, but the constant documents the mapping so call sites can name the intent.

const TYPE_TITLE: Modifier

type.title — screen title, one per screen, states its one job.

Functions

fn accent_action() -> Style

Style for the single primary action on a screen: color.accent.action, bold (docs/design/system.md §4.2). Exactly one element per screen may use this.

fn base() -> Style

Base ground style: color.bg.base background.

fn body() -> Style

Style for primary reading text: color.text.primary.

fn caution() -> Style

Style for attention/unverified status text: color.status.caution.

fn danger() -> Style

Style for failed/danger status text: color.status.danger, bold.

fn locked() -> Style

Style for locked state: color.text.muted — deliberately not danger red, since locking is the safe state (docs/design/system.md §4.4).

fn muted() -> Style

Style for muted/secondary text: color.text.muted, dim.

fn panel() -> Style

Base panel style: color.bg.panel background, color.text.primary foreground (docs/design/system.md §4.1).

fn verified() -> Style

Style for verified/passed status text: color.status.verified, bold.