o
odinpkg.dev
packages / library / colourspace

colourspace

6f5d05alibrary

A pragmatic set of modern colour space transforms

No license · updated 3 weeks ago

colourspace

A pragmatic set of modern colour space transforms

Overview

colourspace provides correct, minimal colour space transforms optimised for UI frameworks and creative tooling, covering OkLCh, OkLab, sRGB, Display P3, Rec. 2020, and Rec. 2100. Transforms are direct matrix multiplications with pre-computed matrices derived with tools/builder.odin. Perceptual manipulation and colour appearance work uses OkLab as the working space.

Gamut mapping is explicitly out of scope. Out-of-gamut values are passed through as-is, and handling is left to the caller — typically shader-side in a display pipeline.

High Dynamic Range (HDR) Support

Rec. 2020 and Rec. 2100 spaces along with Rec. 709, Perceptual Quantizer and Hybrid Log-Gamma transfer functions can be enabled with: -define:COLOURSPACE_ENABLE_HDR

References

Björn Ottosson

International Color Consortium (ICC)

ITU-R (Rec. 2020)