MCPcopy Create free account
hub / github.com/GCWing/BitFun / idx_to_ansi16

Function idx_to_ansi16

src/apps/cli/src/ui/theme.rs:613–634  ·  view source on GitHub ↗
(idx: u8)

Source from the content-addressed store, hash-verified

611}
612
613fn idx_to_ansi16(idx: u8) -> Color {
614 // Basic mapping for 0-15.
615 match idx {
616 0 => Color::Black,
617 1 => Color::Red,
618 2 => Color::Green,
619 3 => Color::Yellow,
620 4 => Color::Blue,
621 5 => Color::Magenta,
622 6 => Color::Cyan,
623 7 => Color::Gray,
624 8 => Color::DarkGray,
625 9 => Color::LightRed,
626 10 => Color::LightGreen,
627 11 => Color::LightYellow,
628 12 => Color::LightBlue,
629 13 => Color::LightMagenta,
630 14 => Color::LightCyan,
631 15 => Color::White,
632 _ => Color::Gray,
633 }
634}
635
636fn rgb_to_ansi16(r: u8, g: u8, b: u8) -> Color {
637 // Simple luminance+dominant-channel approximation.

Callers 2

readable_foreground_forFunction · 0.85
to_ansi16Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected