Skip to content

Conversation

@gravitystorm
Copy link
Collaborator

This PR adds the perceptual colour functions, which are familiar for users of CartoCSS (like me). I've also had to add a "mix" function since that isn't native to Chroma, along with a "mixp" variant that's not found in CartoCSS but seems reasonable to include.

Each function is tested, and for ease of comparison is tested alongside the chroma version. The chroma mixins for Integer were adapted for functions that require 0 and 2 parameters (e.g. greyscale and mix, respectively).

I've made a sense-check of each function against the output from CartoCSS, which indicated the algorithms are the same. There were about 3-4 cases where the output colour was 1-bit different in a particular colour channel. I assume that's a rounding issue and I don't think this is significant.

The only functions not implemented from CartoCSS are the "fadein/fadeout/fadeinp/fadeoutp" group, since they rely on colours having transparency. I'll open a separate issue for that.

Refs #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant