OKLCH

Type module

Sources

Items from OKLCH can be imported/included and used via following ways.

/**
 * --------------------------------------------------------
 * Import via: OKLCH.ts
 * Access items like: $oklch.myVariable
 *                    $oklch.myFunction()
 * --------------------------------------------------------
 */
import * as $oklch from "@amcharts/amcharts5/OKLCH";

Variables

OKLCH does not have any variables.

Functions

cbrt(

x: number

)

#

Returns number

clamp01(

x: number

)

#

Returns number

colorToOKLCH(

color: Color

)

#

Returns IOKLCH

Converts a Color to its OKLCH components.

inGamut(

lin: ...

)

#

Returns boolean

lchToLinear(

l: number,
c: number,
h: number

)

#

Returns void

linearToOklab(

r: number,
g: number,
b: number

)

#

Returns void

oklabToLinear(

L: number,
A: number,
B: number

)

#

Returns void

oklchToColor(

l: number,
c: number,
h: number,
clamp: boolean

)

#

Returns Color

Converts OKLCH components to a Color.

By default, colors that fall outside the sRGB gamut are brought back in by reducing chroma while holding lightness and hue constant (a binary search), which preserves the intended color far better than a naive per-channel clip.

toGamma(

c: number

)

#

Returns number

toLinear(

c: number

)

#

Returns number