@pbroom/color-kitConversion

oklchToColor

Convert an Oklch value to a Color, normalizing the hue to [0, 360). Color is itself OKLCH, so the other channels are copied unchanged.

functionimport { oklchToColor } from '@pbroom/color-kit';oklch.ts:137
function oklchToColor(oklch: Oklch): Color;

Parameters

oklchOklch
OKLCH color

Returns

ColorA new Color

Example

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

oklchToColor({ l: 0.7, c: 0.1, h: -30, alpha: 1 }); // → { l: 0.7, c: 0.1, h: 330, alpha: 1 }

See also