Expand description
Allocation-free ANSI SGR (Select Graphic Rendition) foreground/background parser.
The kernel console and the userspace loggers all emit ESC [ ... m. Only
the colour subset is needed, so this crate keeps the parser total and
zero-dependency: any unsupported or malformed parameter list leaves the
state untouched and reports failure. The caller owns packing the resolved
Rgb into its own framebuffer format.
cargo test -p ansi-sgrStructs§
- Rgb
- An sRGB colour, model-neutral (the caller packs it for its own framebuffer).
- SgrState
- Foreground/background overrides carried by ANSI SGR, cleared by reset.
Constants§
- MAX_
PARAMS 🔒 - Maximum number of numeric parameters accepted in one SGR list.
- PALETTE 🔒
- Classic 16-colour palette (VGA/xterm values): 0-7 standard, 8-15 bright.
Functions§
- xterm_
rgb - xterm 256-colour palette entry: 0..=15 standard, 16..=231 6x6x6 cube (levels 0,95,135,175,215,255), 232..=255 grey ramp 8+10*(n-232).