Skip to main content

Module color

Module color 

Source
Expand description

Colors: Rgb values and the Palette of named colors (game ADR-0012).

Code refers to colors by name, never raw RGB. The colors a game’s code needs are its ColorSet, an enum whose every name the palette must have, so a missing name is impossible at render time; the engine’s own widgets ask for the few EngineColors, which the game’s set names. Data-driven names (terrain) go through Palette::lookup and are validated when their content is loaded.

Structs§

Palette
Named colors, built from the validated PaletteDef for a game’s ColorSet.
Rgb
A 24-bit RGB colour. Ordered red, then green, then blue: an order for maps, not a look.

Enums§

EngineColor
The colors the engine’s own widgets ask for. A game’s ColorSet says which of its palette’s names each one is (engine_name).

Constants§

DIM_DARK
How bright a dimmed colour is left (1 = as bright as it was). Tunable: the first renders used 0.6; Nick, seeing it in the game on 2026-10-03, chose to lighten it a bit (ticket 0436).
DIM_GREY
How far a dimmed colour goes to its own grey (0 = not at all, 1 = grey). Tunable.

Traits§

ColorSet
The colors a game’s code draws with, by name: usually an enum, whose every name its palette must have.

Functions§

required_names
Every name a palette for the set C must have: the set’s, in its order, then the engine colors’ that it doesn’t already name.
to_channel
Rounds and saturates a channel value to 0..=255.