Beyond · The terminal
Colour depth
Sumi describes colour at full fidelity and narrows it to the terminal at the last moment. RGB colours are quantised at emission time to the terminal’s detected depth: truecolor emits 24-bit RGB verbatim, 256 picks the nearest xterm-256 entry, 16 picks the nearest of the eight ANSI colours, and mono drops colour entirely, keeping only attributes like bold and underline.
Depth comes from the environment, not from your CSS: NO_COLOR forces mono,
COLORTERM=truecolor forces truecolor, a TERM containing 256color gives 256,
TERM=dumb gives mono, and otherwise sumi assumes 16. The same binary adapts to
whatever terminal runs it — you do not ship different builds.
One thing never degrades: the eight ANSI keywords (red, green, cyan, …)
are palette names, not fixed RGB, so they pass through every depth untouched
and follow the terminal’s own theme. Reach for them when you want colour that
survives on a limited terminal.
This lesson has no Solve — it is here to read and run. The swatches below are
fixed hex colours. This browser terminal reports truecolor, so you see them
exactly; on a 16-colour terminal each would snap to the nearest ANSI colour, and
under NO_COLOR they would vanish to plain text.
Your turn
Press Run to render the swatches, then try editing the hex values. Every 24-bit colour shows precisely here — which is exactly the fidelity that quantisation collapses on a lesser terminal.