@pbroom/color-kitConversion

toOklabInto

Convert a Color to OKLab, writing into out (allocation-free). Bit-identical to toOklab.

functionimport { toOklabInto } from '@pbroom/color-kit';into.ts:55
function toOklabInto(  out: Oklab, ,  color: Color,): Oklab;

Parameters

outOklab
Object to write the result into
colorColor
Color to convert

Returns

Oklabout

Example

TypeScript
import { parse, toOklabInto } from '@pbroom/color-kit';

const lab = { L: 0, a: 0, b: 0, alpha: 1 };
toOklabInto(lab, parse('#3b82f6'));
lab.L; // → ≈ 0.6231