What it does
HSLuv is a colour model and set of implementations based on CIELUV. It expresses available chroma as a saturation percentage, with a browser demonstration for hue, saturation and lightness.
HSLuv calculates the colour boundary for a chosen hue and lightness, then expresses saturation within that boundary. HPLuv uses a more restricted common chroma range across hues, producing its pastel variant.
Choose an implementation for the language in use. The Python package converts hue, saturation and lightness into hex or RGB and supports the reverse conversions. Hue uses 0 to 360, while saturation and lightness use 0 to 100.
The Python implementation leaves small floating-point errors visible, so output may need rounding before display. Port authors can compare results against the reference project’s JSON snapshots, including intermediate conversion values.
The reference implementation is MIT licensed and the mathematics is public domain. Individual ports have their own documentation and licence terms.
Strengths
- Reference snapshots help verify conversions in another programming language.
Watch out for
- Port-specific numerical behaviour and licensing need checking.
Best for
- Developers building colour pickers or hue-based palettes
Sources
- HSLuv overview and demonstration (Oct 27, 2026)
- HSLuv and HPLuv mathematics (Oct 27, 2026)
- HSLuv implementations and porting (Oct 27, 2026)
- HSLuv Python conversion reference (Oct 27, 2026)
