linearRgbToOklabInto
Convert linear sRGB to OKLAB, writing into out (allocation-free). 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/
import { linearRgbToOklabInto } from '@pbroom/color-kit';oklab.ts:34function linearRgbToOklabInto( out: Oklab, , rgb: LinearRgb,): Oklab;Parameters
Returns
Oklabout
Example
import { linearRgbToOklabInto } from '@pbroom/color-kit';
const lab = { L: 0, a: 0, b: 0, alpha: 1 };
linearRgbToOklabInto(lab, { r: 1, g: 0, b: 0, alpha: 1 });
lab.L; // → ≈ 0.628