Skip to main content

Module color

Module color 

Source
Expand description

Stable per-solid display colors + color-space helpers.

solid_color_srgb is a byte-faithful port of the retired artifact renderer’s solidColor: FNV-1a over the name’s UTF-16 code units, hue = ((hash >>> 8) % 360)/360, HSL(hue, 0.45, 0.6). Keeping the hash EXACT means re-baselined artifacts keep the colors users already know.

Functions§

hex_to_linear
A 0xRRGGBB hex color → linear-space RGB (for light/material constants).
hex_to_srgb
A 0xRRGGBB hex color → sRGB-space RGB in 0..1 (for clear colors written to a non-sRGB target, where the bytes should equal the hex exactly).
solid_color_srgb
The stable per-solid display color, in sRGB (0..1 per channel).
srgb_to_linear
sRGB electro-optical transfer (decode): sRGB component → linear.