Okhsl
The Okhsl color space is not registered in Color
by default
Properties
Name: okhsl
White Point: D65 / 2˚
Coordinates:
Name | Range |
---|---|
h | [0, 360) |
s | [0, 1] |
l | [0, 1] |
Okhsl was created by Björn Ottosson and is a transform of the Oklab color space that approximates the sRGB gamut perceptually in an HSL color model. The aim was to create a color space that was better suited for being used in color pickers than the current HSL.
Channel Aliases
Channels | Aliases |
---|---|
h | hue |
s | saturation |
l | lightness |
Input/Output
Okhsl is not currently supported in the CSS spec, the parsed input and string output formats use the color()
function format using the custom name --okhsl
:
color(--okhsl h s l / a) // Color function
When manually creating a color via raw data or specifying a color space as a parameter in a function, the color space name is always used:
Color("okhsl", [0, 0, 0], 1)
The string representation of the color object and the default string output use the color(--okhsl h s l / a)
form.
>>> Color("okhsl", [29.234, 1, 0.56808], 1)
color(--okhsl 29.234 1 0.56808 / 1)
>>> Color("okhsl", [70.67, 1, 0.75883], 1).to_string()
'color(--okhsl 70.67 1 0.75883)'
Registering
from coloraide import Color as Base
from coloraide.spaces.okhsl import Okhsl
class Color(Base): ...
Color.register(Okhsl())