mapbox / carto

fast CSS-like map stylesheets
https://cartocss.readthedocs.io/
Apache License 2.0
652 stars 129 forks source link

Perceptual color support #422

Closed nebulon42 closed 8 years ago

nebulon42 commented 8 years ago

I'd like to view this as proof of concept and base for discussion. Fixes #354. Builds upon #418.

Basically this PR adds support for HUSL (http://www.husl-colors.org/) perceptual colours. I have chosen that over Lch or Lab, because it doesn't allow the definition of colours that cannot be represented in the RGB colour space. This and its similarity to HSL make its use convenient and avoids trial-and-error colour definitions (see https://github.com/mapbox/carto/issues/354#issuecomment-165576590 for an expanded explanation why I think this is beneficial).

The implementation has the following characteristics:

The similarity of hsl and husl in terms of values keeps the representation simple. The perceptual colour space is kind of sticky. Once you are in it is difficult to get out again, but I thought this would be no problem.

I have extended test coverage, which @pnorman started in #418, further to all new colour functions.

nebulon42 commented 8 years ago

This is a bigger change. @tmcw @springmeyer Thoughts?