GitHub - heavyrain266/colourspace: A pragmatic set of modern colour space transforms

GitHub

1 min read Original article ↗

A pragmatic set of modern colour space transforms

Overview

The colourspace package provides correct, perceptual colour space transforms optimised for UI frameworks and creative tooling. Out-of-gamut values are passed through as-is, with gamut mappings left to the caller — typically shader-side in a display pipeline.

Colour Spaces

Each one of the spaces covered below comes with related non-linear transfer curves and procedures (encode_*/decode_*).

  • Perceptual:
    • OkLab, OkLCh,
  • Standard Dynamic Range:
    • sRGB, Display P3, Adobe RGB (1998),
  • High Dynamic Range:
    • Rec. 2020, Rec. 2100 (via PQ and HLG)

Furthermore, any "missing" tristimulus spaces are trivial to add using tools/builder.odin script, which generates the bidirectional transform matrices.

References

Björn Ottosson

International Color Consortium (ICC)

ITU-R