[Standards] XEP-0392 (Consistent Color Generation): Include HSLuv conversion formula

Jonas Schäfer jonas at wielicki.name
Thu Jul 11 18:19:06 UTC 2019


Hi Paul :)

On Mittwoch, 10. Juli 2019 23:10:39 CEST Paul Schaub wrote:
> I recently updated my implementation of XEP-0392 to version 0.6.0 and I
> ended up having to include a third party library to get my
> implementation to match the provided test vectors.
> 
> The XEP states:
> "Use the HSLuv operation hsluvToRgb to convert the Hue angle to a color."

I could’ve sworn I linked to this page (or at least domain): 
http://www.hsluv.org/math/

This describes how HSLuv (which is distinct from HSL, so your difference in 
results is easily explained) works, and also lists implementations.

It is by no means a simple conversion, and yes it passes through at least one 
other colour space.

During the development of the XEP, we figured out that there is no easy way to 
get consistent apparent brightness of different colours without going through 
CIELAB (which is kind of made for that purpose), which is a nasty beast of a 
colour space (when aiming to go back to RGB eventually). I’m glad that there’s 
HSLuv which exists as (very liberally licensed) libraries for various 
languages, taking care of that conversion.

If that doesn’t fly for you, you can still use standard HSL or HSV, or the 
YCbCr approach from earlier versions (but you need an offset in that case), 
but with inconsistent brightness -- which may or may not be a problem in your 
case.

kind regards,
Jonas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.jabber.org/pipermail/standards/attachments/20190711/ce672e99/attachment.sig>


More information about the Standards mailing list