Module color.hsl

HSL color values and conversion to and from encoded sRGB.

HSL is provided for interoperability, color-pickers, CSS-like input, and familiar lightness/saturation editing. It is not a perceptual replacement for Oklab or OKLCH. Hue is stored in degrees; conversion normalizes complete revolutions to the canonical [0, 360) interval and canonicalizes achromatic colors to hue 0.

Functions

NameDescription
toHsl(color) Converts encoded sRGB to HSL.
toSRgb(color) Converts HSL to encoded sRGB without clipping or gamut mapping.

Structs

NameDescription
Hsl HSL values with hue in degrees and saturation/lightness as ratios.

Aliases

NameTypeDescription
Hsld Hsl!(double) HSL with double components.
Hslf Hsl!(float) HSL with float components.