Page
Library
Module
Module type
Parameter
Class
Class type
Source
HSLuv human-friendly color space implementation in OCaml.
See https://www.hsluv.org/.
This OCaml package implements the HSLuv color space model, providing a perceptually uniform alternative to traditional HSL. It includes functions for converting between HSLuv/HPLuv and other color spaces like RGB, XYZ, and Luv.
The HSLuv color space is particularly beneficial in scenarios where perceptual uniformity and intuitive color manipulation are crucial:
In summary, HSLuv's appeal lies in its ability to provide visually consistent and natural-looking colors, making it suitable for design, data visualization, and artistic applications.
This started as a port of the Go implementation of hsluv.org.
The following color conversions are provided:
From/To | HSLuv | HPLuv | RGB | XYZ | LUV | LCH | HEX |
---|---|---|---|---|---|---|---|
HSLuv | - | - |
| - | - |
|
|
HPLuv | - | - |
| - | - |
|
|
RGB |
|
| - |
| - |
|
|
XYZ | - | - |
| - |
| - | - |
LUV | - | - | - |
| - |
| - |
LCH |
|
|
| - |
| - | - |
HEX |
|
|
| - | - | - | - |
In addition to the HSLuv and HPLuv conversion functions, this package also exposes
pp_hsluv
, pp_hpluv
, etc.hsluv.float_conv
for conversions between float triples and the provided color typesThe implementation is tested against the hsluv snapshot (revision 4). Tests for all conversion functions are included and can be run with
opam exec -- dune test