Skip to main content

Function: rgbToOklch()

rgbToOklch(rgb): Oklch

Converts RGB values to formatted Oklch color space.

Parameters

ParameterTypeDescription
rgbRGBAn object with r, g, and b properties.

Returns

Oklch

An object with L (percentage), C and h (full numbers) properties.

Throws

If the input is not a valid RGB object or if RGB values are out of range.

Defined in

conversions/components/oklch.ts:16