Skip to main content

Module theme

Module theme 

Source
Expand description

§Display theme

The one source of every color and text style that scope shows in a terminal: CLI output, the TUI and the monitor. Callers name a semantic Role; tone is the single mapping from a role to its look.

This module is presentation policy. It holds no framework type: the adapters translate a Tone to their medium (the text painter in text for CLI output; ratatui styles in the CLI crate).

Only the 16 named ANSI colors are used, so the terminal’s own palette decides the exact shade on dark and light themes.

Re-exports§

pub use crate::config::ColorScheme as Scheme;

Structs§

Painter
Paints text for one output stream: with escape codes when color is on for it, as the text unchanged when color is off.
Tone
How a role looks: a foreground color (None keeps the terminal’s default) and text effects.

Enums§

AnsiColor
The 16 named ANSI foreground colors.
Direction
Which way a monitored value moved.
Role
What a piece of text means. Callers pick a role; never a color.

Constants§

SERIES_TONES
The tones of the series of one chart, one per venue, in venue order (design 2026-11-04, section 2.9). None is a health color (green, yellow, red), and none is a bright variant, which is weak on a light background. From the fifth series the tones repeat; the chart tells those apart by their marker.

Functions§

color_enabled
Returns true when output to stdout may use color.
color_enabled_stderr
Returns true when output to stderr may use color.
color_enabled_with
Decides whether to emit color for one stream. Pure: the caller passes the environment and whether the stream is a terminal.
paint
text in the tone of role, for stdout.
scheme_role_tone
The tone of role in a monitor under scheme. The monochrome scheme shows no color, so it keeps only the role’s effects (bold, dim, …).
scheme_tone
The tone of a value that moved in direction under a monitor scheme. A flat value is always plain; the monochrome scheme is always plain.
set_color_override
Forces color off (Some(false)) or on (Some(true)) for the whole process, or removes the override (None). --no-color uses it.
tone
The single mapping from a role to its tone. The role table in docs/design/2026-10-13-tui-color-theme.md is its specification.