Skip to main content

Module color

Module color 

Source
Available on crate feature raster only.
Expand description

Color under constraint (Task 4): the deck’s gold->bone->crimson heat canon, a deterministic 256-palette quantization, and the per-cell “one fg + one bg” pick under the braille glyph floor.

heat is a verbatim transcription of topology-deck.html:277-284 (mix(a,b,t)=a+(b-a)*t, |0 = .floor() as u8). to_ansi256 mines the 6x6x6 cube + 24-step grayscale ramp technique described in the plan (Task 4 Step 3) — this crate carries no vendored copy of tui-3d-renderer, so the formula is transcribed from the plan text, which is itself the authoritative source for this fn.

Enums§

Palette
The output palette a CellGrid is rendered under.

Functions§

heat
Gold(low) -> bone -> crimson(high), transcribed verbatim from the deck’s heat() (topology-deck.html:278-284). t is clamped to [0,1].
to_ansi256
Quantize a truecolor Rgb to an ANSI-256 palette index: the 24-step grayscale ramp (232..=255) when r==g==b, else the 6x6x6 color cube (16..=231). Tie-break pinned to f64::round (round-half-away-from-zero, IEEE-754 reproducible per user CLAUDE.md §4) — never truncating as u8.