How to Convert OKLab to CIELAB (Lab)
Converting OKLab to CIELAB (Lab) moves a color between two perceptual color spaces. Both spaces use the same L, a, and b axes, but they calculate them using different mathematical foundations.
OKLab vs. CIELAB
CIELAB was the standard for perceptual color for decades, but it has known flaws. The most prominent is the "blue shift." When transitioning from blue to white in CIELAB, the color shifts toward purple. It also struggles to maintain consistent perceived saturation across different hues.
OKLab was created in 2020 to fix these specific issues. It uses LMS (Long, Medium, Short) cone responses to better simulate how the human eye processes light. While OKLab is generally superior, you may need to convert back to CIELAB for compatibility with older color science tools or specific print workflows.
The Conversion Pipeline
You cannot map OKLab coordinates directly to CIELAB coordinates. The color must be translated back into a linear light space first.
- Convert OKLab to Linear sRGB using inverse LMS matrices.
- Convert Linear sRGB to the CIE XYZ reference space (using a D50 white point).
- Apply the CIELAB non-linear curve to get the new
L,a, andbvalues.