linearRgbToOklab
Convert linear-light sRGB to OKLab.
import { linearRgbToOklab } from '@pbroom/color-kit';oklab.ts:81function linearRgbToOklab( rgb: LinearRgb,): Oklab;Based on Björn Ottosson's OKLab model, using the CSS Color 4 matrices recalculated in float64 for a consistent D65 reference white (bottosson.github.io/posts/oklab/). Inputs are not clamped, so out-of-gamut linear values convert exactly.
Parameters
Returns
Example
import { linearRgbToOklab } from '@pbroom/color-kit';
linearRgbToOklab({ r: 1, g: 0, b: 0, alpha: 1 });
// → ≈ { L: 0.628, a: 0.2249, b: 0.1258, alpha: 1 }