Skip to content

OkLCh

The OkLCh color space is registered in Color by default

Properties

Name: oklch

White Point: D65 / 2˚ / 2˚

Coordinates:

Name Range*
l [0, 1]
c [0, 0.4]
h [0, 360)

* Space is not bound to the range and is only used as a reference to define percentage inputs/outputs in relation to the Display P3 color space.

OkLCh

The sRGB gamut represented within the OkLCh color space.

OkLCh is the cylindrical form of Oklab.

Learn about OkLCh

Channel Aliases

Channels Aliases
l lightness
c chroma
h hue

Input/Output

Parsed input and string output formats support all valid CSS forms. Additionally, the color() function format can be used as well with the custom name --oklch.

oklch(l c h / a)          // OkLCh function
color(--oklch l c h / a)  // Color function

The string representation of the color object will always default to the color(--oklch l c h / a) form, but the default string output will be the oklch(l a b / a) form.

>>> Color("oklch", [0.62796, 0.25768, 29.234])
color(--oklch 0.62796 0.25768 29.234 / 1)
>>> Color("oklch", [0.79269, 0.17103, 70.67]).to_string()
'oklch(0.79269 0.17103 70.67)'
>>> Color("oklch", [0.96798, 0.21101, 109.77]).to_string(percent=True)
'oklch(96.798% 52.753% 109.77)'
>>> Color("oklch", [0.51975, 0.17686, 142.5]).to_string(color=True)
'color(--oklch 0.51975 0.17686 142.5)'

Registering

from coloraide import Color as Base
from coloraide.spaces.oklch import OkLCh

class Color(Base): ...

Color.register(OkLCh())