←back to thread

276 points samwillis | 1 comments | | HN request time: 0.206s | source
1. refulgentis ◴[] No.41081832[source]
TL;DR: Imagine color space has 3 dimensions in polar coordinates.

- hue, the angle. your familiar red, orange, yellow, green, blue...

- saturation/chroma, radial distance from center. intensity of the pigment

- lightness, top to bottom, white to black

The XY diagram shows 3d color space, from the top, in XYZ.

XYZ is a particular color space that Nathan Myhrvold picked at Microsoft in the early 90s.

There is no privileged "correct" color space, they're developed based on A/B tests and intuition by color scientists.

However, there are more correct color spaces, in that color science matters and is a real field. Commonly agreed state of the art is CAM16.

It's a significant mistake that Oklab is the first space with significant mindshare since HSL, it was a quick hack by a ex-game developer to make something akin to CAM16 with just one matrix multiplication.

CAM16 conversions involve significantly more than one matrix multiplication. But, its ~400 lines of code, and you can do millions a second on modern hardware.

The lightness scale is _way_ off from scientific color spaces, and thus it can't be used to create simple rules like "40 delta L* ~= 3.0 contrast ratio, 50 delta L* ~= 4.5 contrast ratio". Instead you're still manually plugging colors into a contrast checker :(

Then again, its still a step forward. It's even more maddening HSL was used for so long: it's absolutely absurd, ex. lightness = average of two highest RGB components. Great for demo hacks in 1976, not so great in 2016.