Skip to main content

Module theme

Module theme 

Source
Expand description

UI theme (DESIGN.md §5.6, §5.12).

Holds the customizable styling knobs the renderer reads each frame. v1 ships a built-in default that matches vim’s classic split visuals (active status line reverse-videoed, inactive dim, vertical separator with │); every field is exposed via :set ui.* options so a user / config layer can override it.

Adding a new themable surface is two edits: add a field to Theme with its default + add an OptionSpec in crate::options::builtin_options() that mutates that field.

Structs§

Theme
One full UI theme. Cheap to clone (Style + char fields are all Copy); the App holds it directly and :set ui.* writes through.

Functions§

build_tui_theme
Build the ratatui-typed Theme cache from the resolved theme table plus the non-style ui.* typed options. The TUI’s App.theme cache is the renderer’s hot-path adapted view; it is rebuilt at theme-change / option-set rate, never per frame.
diagnostic_glyph_and_style
Resolve the per-severity rendering bits from the theme. Returns (glyph, style).
host_color_to_ratatui
Adapt a renderer-neutral host_theme::Color into a ratatui [Color]. Lossless on all variants except Rgb when the terminal doesn’t support truecolor – in that case the renderer’s frame submission stage handles the lossy fallback (ratatui already does palette closest-match itself).
host_style_to_ratatui
Adapt a renderer-neutral host_theme::Style into a ratatui [Style]. Empty fg/bg map to “unset” on the ratatui side (same as Style::default()); modifiers chain via add_modifier.
parse_color
Parse a user-typed color name into a ratatui [Color].