MarketOklab color space
Company Profile

Oklab color space

The Oklab color space is a uniform color space for device-independent color designed to improve perceptual uniformity, hue and lightness prediction, color blending, and usability while ensuring numerical stability and ease of implementation. Introduced by Björn Ottosson in December 2020, Oklab and its cylindrical counterpart, Oklch, have been included in the CSS Color Level 4 and Level 5 drafts for device-independent web colors since December 2021. They are supported by recent versions of major web browsers and allow the specification of colors within the DCI-P3 gamut but outside sRGB.

Coordinates
Oklab uses the same spatial structure as CIELAB, representing color using three components: • L for perceptual lightness, ranging from 0 (pure black) to 1 (reference white, if achromatic), often denoted as a percentagea and b for opponent channels of the four unique hues, unbounded but in practice ranging from −0.5 to +0.5; CSS assigns ±100% to ±0.4 for both ==Conversions between color spaces==
Conversions between color spaces
Conversion to and from Oklch Like CIELCh, the Cartesian coordinates a and b are converted to the polar coordinates C and h as follows: \begin{align} C &= \sqrt{a^2 + b^2}, \\ h &= \operatorname{atan2}(b, a), \end{align} and the polar coordinates are converted to the Cartesian coordinates as follows: \begin{align} a &= C \cos h, \\ b &= C \sin h. \end{align} Conversion from CIE XYZ Converting from CIE XYZ with a Standard Illuminant D65 involves: • Applying the linear map which converts the XYZ values into a space analogous to the LMS color space: \begin{bmatrix} l \\ m \\ s \end{bmatrix} = \mathbf M_1 \begin{bmatrix} X \\ Y \\ Z \end{bmatrix}. • Applying a cube root non-linearity: \begin{bmatrix} l' \\ m' \\ s' \end{bmatrix} = \begin{bmatrix} l^{1/3} \\ m^{1/3} \\ s^{1/3} \end{bmatrix}. • Converting to Oklab with another linear map: \begin{bmatrix} L \\ a \\ b \end{bmatrix} = \mathbf M_2 \begin{bmatrix} l' \\ m' \\ s' \end{bmatrix}. The linear-map matrices are \begin{align} \mathbf M_1 &= \begin{bmatrix} 0.8189330101 & \phantom{-}0.3618667424 & -0.1288597137 \\ 0.0329845436 & \phantom{-}0.9293118715 & \phantom{-}0.0361456387 \\ 0.0482003018 & \phantom{-}0.2643662691 & \phantom{-}0.6338517070 \end{bmatrix}, \\ \mathbf M_2 &= \begin{bmatrix} 0.2104542553 & \phantom{-}0.7936177850 & -0.0040720468 \\ 1.9779984951 & -2.4285922050 & \phantom{-}0.4505937099 \\ 0.0259040371 & \phantom{-}0.7827717662 & -0.8086757660 \end{bmatrix}. \end{align} Conversion from sRGB Converting from sRGB requires first converting from sRGB to CIE XYZ with a Standard Illuminant D65. As the last step of this conversion is a linear map from linear RGB to CIE XYZ, the reference implementation directly employs the multiplied matrix representing the composition of the two linear maps: \begin{bmatrix} l \\ m \\ s \end{bmatrix} = \begin{bmatrix} 0.4122214708 & 0.5363325363 & 0.0514459929 \\ 0.2119034982 & 0.6806995451 & 0.1073969566 \\ 0.0883024619 & 0.2817188376 & 0.6299787005 \end{bmatrix} \begin{bmatrix} R_\text{linear} \\ G_\text{linear} \\ B_\text{linear} \end{bmatrix}. Conversion to CIE XYZ and sRGB Converting to CIE XYZ and sRGB simply involves applying the respective inverse functions in reverse order: \begin{align} \begin{bmatrix} l' \\ m' \\ s' \end{bmatrix} &= \mathbf M_2^{-1} \begin{bmatrix} L \\ a \\ b \end{bmatrix}, \\ \begin{bmatrix} l \\ m \\ s \end{bmatrix} &= \begin{bmatrix} (l')^3 \\ (m')^3 \\ (s')^3 \end{bmatrix}, \\ \begin{bmatrix} X \\ Y \\ Z \end{bmatrix} &= \mathbf M_1^{-1} \begin{bmatrix} l \\ m \\ s \end{bmatrix}. \end{align} ==Notes==
tickerdossier.comtickerdossier.substack.com