Large, colorful circles: oklab vs rgb

Alec Jacobson

December 18, 2024

weblog/

I love the 'oklab' color space. This space is approximately perceptually uniform, meaning that --- unlike the common RGB space --- distance in oklab space is meant to correspond to perceived color differences.

For visualiztaion its often useful to have uniform, cyclic color maps. Using oklab, we can find a rainbow colormap --- which varies only hue --- by looking for the largest inscribed circle orthogonal to (and centered on) the luminance axis.

Searching for a big isoluminance circle in oklab space. The gamut is the RGB cube transformed into oklab space.

Amazingly, the biggest inscribed circle along the luminance axis in the OKlab gamut occurs at ℓ ≈ 75%. The author of oklab, Björn Ottosson, confirmed that this was serendipitous

Colors along the largest isoluminance circle.

That isoluminance circle has a radius of about 0.1275. The biggest circle I could find in the oklab gamut has almost twice the radius (0.2338). Trades some of that rainbow hue change for luminance variation. It doesn't have as pretty colors.

In contrast, consider (one of) the largest circles in RGB space.

A largest circle in rgbspace.
Corresponding colors.

This is just one of 4 largest circles. Here are the others.

Corresponding colors of the large circle orhtogonal to the diagonal of grays. (This one doesn't look too bad, but gets "pinched" around the greens.)
Colors of another large circle.
Colors of the last large circle.