etui/style
Types
Terminal color. Default defers to the terminal theme.
Indexed(n) covers the whole 256-color space: 0 to 15 are the themeable
ANSI colors, 16 to 255 the extended palette (the 6x6x6 cube and the
grayscale ramp).
Rgb(r, g, b) uses 24-bit true color and needs a truecolor terminal.
pub type Color {
Default
Indexed(Int)
Rgb(Int, Int, Int)
}
Constructors
-
Default -
Indexed(Int) -
Rgb(Int, Int, Int)
Opaque bitfield for text modifiers. Use constants + add/remove/has.
pub opaque type Modifier
Values
pub fn ansi_modifier(m: Modifier) -> String
Text modifier escape sequence. Emits all active modifier bits.
pub fn color_from_hex(hex: String) -> Result(Color, Nil)
Parse an RGB color from a hex string ("#RRGGBB" or "RRGGBB").
Returns Error(Nil) for malformed input.
style.color_from_hex("#1e1e2e") // Ok(Rgb(30, 30, 46))
style.color_from_hex("ff5555") // Ok(Rgb(255, 85, 85))
pub fn patch(base: Style, over: Style) -> Style
Apply over on top of base. Default fg/bg fall back to base.
Modifier: if over has any bits set, they are OR’d into base;
none() in over means “no modifier override” (keep base).