pub const fn rgb_to_xterm16(r: u8, g: u8, b: u8) -> u8
Convert an RGB triplet to the nearest xterm-16 / BIOS-style index (0..=15).
Uses the Hue-Chroma-Lightness colour model for perceptually plausible quantization.