-
Notifications
You must be signed in to change notification settings - Fork 826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to husl colours? #2492
Comments
I'm going to let others comment first because I'm a bit biased here. Just to explain why LCh is not directly supported by CartoCSS: All colours have to be converted to RGB for Mapnik in the end. Therefore, working with colours that possibly can have a gamut outside of RGB is a bit tedious. The best example for that is the road colour generation script. If you play with the colours there you frequently run into the "outside of RGB" error and have to start again. |
IMO colors should normally be developed in a perceptually uniform color space. Lch as a polar coordinate version of Lab qualifies as such, husl as far as i see it does not. For rendering specifying colors in something other than 3x8 bit sRGB (that is the usual hex color notation) has little added value unless the rendering engine processes colors with more than 8 bit accuracy or in other color spaces which AFAIK mapnik does not. If there is a decent online converter that allows easy conversion including husl (i mostly use http://davidjohnstone.net/pages/lch-lab-colour-gradient-picker) i would not have any problem with colors specified in husl myself but it probably would create an additional entry barrier for contributors. As @nebulon42 explained in #2462 the advantage to have non-distorting Is there a precise mathematical definition of husl somewhere by the way? Looking at https://github.com/husl-colors/husl-python/blob/master/husl.py the core of the definition seems to be the function |
@imagico I'm open to other colour spaces in carto. So I invite you to open a ticket there and let's discuss the details further. I'm especially interested how you want to spare users a trial-and-error process and how you would handle edge cases - colour clipping? |
👎 to using hsul, 👍 to using a perceptual colour space. For mixing colours you should use Lab, for defining them,, use Lch. Interpolations can be in either depending on needs. If you can't do that (as we can't right now), then use hex values and don't try to read any meaning into what the RGB values mean or do calculations with them. CartoCSS had mapbox/carto#354 about supporting perceptual colour spaces, but was closed without implementing any. |
IMO Husl is still a perceptual colour space. Regarding the math, maybe @boronine has some insight? |
Closing the issue here as nothing can be done on our side currently. |
@math1985 Is the question whether to switch to husl or not already answered for you? |
Perceptually uniform color space means differences between colors as measured in the color space in question are proportional to humanly perceived differences between those colors. This is not the case with husl obviously since it is scaled in chroma based on the sRGB limits which have no physical or physiological basis. |
Our colours are defined in rgb, with sometimes annotations in Lch.
CartoCSS now supports the husl colour space, but not the Lch colour space. Should we switch to husl?
The text was updated successfully, but these errors were encountered: