pub enum Color {
Default,
Named(NamedColor),
Indexed(u8),
Rgb(u8, u8, u8),
}Expand description
Renderer-neutral color. The variants cover every shape any
terminal-or-GPU renderer ever needs: Default for “use the
terminal/window’s default”, Named for the 16 ANSI palette
names (TUI’s 16-color fallback path), Indexed for the
256-color palette, Rgb for 24-bit truecolor.
TUI renderer maps Rgb to Indexed-closest-match when the
terminal doesn’t support truecolor. GPUI ignores Named /
Indexed lookups in palette-aware mode and reads Rgb
directly. The host owns the lossless form; each renderer
owns its own lossy-mapping at adapter time.
Variants§
Default
Terminal / window default for this channel. Maps to
ratatui::Color::Reset.
Named(NamedColor)
One of the 16 named ANSI colors. The TUI’s primary palette path; GPUI maps these to its theme’s named-color table.
Indexed(u8)
256-color palette index (xterm 256-color extension).
Rgb(u8, u8, u8)
24-bit truecolor.
Implementations§
Source§impl Color
impl Color
Sourcepub fn to_rgb_u32(self, fallback: u32) -> u32
pub fn to_rgb_u32(self, fallback: u32) -> u32
Convert to a 24-bit 0xRRGGBB packed u32 for GPU-side
renderers (which want raw truecolor, not the renderer-
neutral Color enum). Color::Default returns
fallback — the caller decides what “use the terminal /
window default channel” means in pixel-space.
Named colors map to canonical ANSI RGB values that match what xterm + most modern terminal emulators use. The indexed (xterm 256) path computes the 6×6×6 cube + the 24-step grayscale ramp standardly.