A pragmatic set of modern colour space transforms for the Odin language
4 points by heavyrain266
4 points by heavyrain266
Awesome, hope this gets vendored in
Don’t think it will, I’ve considered legacy (non-perceptual, flawed) ones myself but it blows up into combinatorial hellscape (n2) with CIE XYZ as a hub. Then you meet people asking for ICC profiles, LUTs and so suddenly you’re implementing half of OpenColorIO. Pre-computed my matrices with throw away NumPy scripts to avoid exact runtime complexity and save cycles. You can map my vectors to SIMD and SoA at call site for easy batching.
Author here, started this out of the need for CSS-style oklch() in my UI framework and frustration with CSS Color Module 4's gamut mapping, which shifts P3 blues to purple on sRGB displays. All transforms use pre-computed matrices with Odin's distinct types catching space mismatches at compile time. Gamut mapping following Björn Ottosson's cusp-projection approach is in progress.