Hacker News new | ask | show | jobs
by jetzzz 1337 days ago
What's the purpose of having 4 linear color spaces (srgb-linear, xyz, xyz-d50, xyz-d65) for interpolation? Linear interpolation is exactly the same in any linear space. Indeed, in provided gradient examples these 4 look the same.
2 comments

Because they're (idealy) not linear, I'd assume. Gamma correction[0] is an exponential-like function. Hence, sRGB vs "sRGB linear". Despite what many people think, sRGB color #808080 is not 50% the brightness of #ffffff, but about 75%. All because our eyes are non-linear.

Color math is a massive rabbit hole that deserves its own "things programmers believe about..."

[0]: https://en.wikipedia.org/wiki/Gamma_correction

The CSS Color (Level 4) spec allows you to interpolate in any color space that you can specify colors in, and all of these four are considered useful to specify colors in. (Or at least useful enough to make it into the spec :-) ) This leads to some redundancy in this specific context, but the alternative would be disallowing three of them in interpolation only, for no good reason at all.