@pbroom/color-kitConversion

oklabToOklchInto

Convert OKLAB to OKLCH, writing into out (allocation-free). Achromatic results (chroma at or below ACHROMATIC_CHROMA_THRESHOLD) get hue 0.

functionimport { oklabToOklchInto } from '@pbroom/color-kit';oklch.ts:28
function oklabToOklchInto(  out: Oklch, ,  lab: Oklab,): Oklch;

Parameters

outOklch
Object to write the result into
labOklab
OKLab color

Returns

Oklchout

Example

TypeScript
import { oklabToOklchInto } from '@pbroom/color-kit';

const lch = { l: 0, c: 0, h: 0, alpha: 1 };
oklabToOklchInto(lch, { L: 0.7, a: 0, b: 0.1, alpha: 1 });
lch; // → { l: 0.7, c: 0.1, h: 90, alpha: 1 }

See also