Implementations

The reference implementation is written in Haxe and released under the MIT license. Check the individual ports for documentation and licensing. The math is available under the public domain.

Porting

Every implementation of HSLuv must provide the following four functions:

hsluvToRgb([H, S, L]) -> [R, G, B]
hpluvToRgb([H, S, L]) -> [R, G, B]
rgbToHsluv([R, G, B]) -> [H, S, L]
rgbToHpluv([R, G, B]) -> [H, S, L]

These functions are implemented as a chain of color space transformations: RGB to CIE XYZ to CIELUV to CIELUV LCh to HSLuv and HPLuv.

If you want to port HSLuv to a different language or finish one of the started ports, you should test your implementation against a JSON snapshot of the color space generated from the reference implementation. The snapshots are stored in the repo. Apart from corresponding RGB and HSLuv values, the snapshots also provide all the intermediate values in the chain of transformations. As such, they can be a useful tool for debugging.

Contact the original author by email.