Expand description
Minimal SGR rendering of theme styles for oomtop theme preview (the TUI uses ratatui instead).
Colors degrade truecolor → 256 → 16 → none exactly like the TUI (UX §12.1.5); default and missing
colors emit nothing, so the terminal’s own foreground/background show through.
Constants§
Functions§
- color_
code - SGR parameter(s) for one color, or
None(terminal default / unsupported at this depth). - paint
textwrapped in the style (no escape codes at all for a plain style).- rgb_
to_ 16 - Nearest of the 16 ANSI colors.
- rgb_
to_ 256 - Nearest xterm-256 index (6×6×6 cube or the 24-step gray ramp).
- sgr
- Full SGR start sequence for a style (“” when the style is plain).
paint_bg = falsedrops backgrounds, as the defaultterminaltheme andappearance.background = "terminal"require.