Skip to content
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

Support LCH colours #660

Open
pnorman opened this issue Aug 2, 2018 · 1 comment
Open

Support LCH colours #660

pnorman opened this issue Aug 2, 2018 · 1 comment

Comments

@pnorman
Copy link
Contributor

pnorman commented Aug 2, 2018

It's normally easier to write colours in a perceptual colourspace than sRGB. This allows you do actions like specify two colours of the same brightness by keeping one number constant, instead of having to do complex sRGB calculations.

Right now what I am doing is color: '#e4efd1' #lch(93,15,120) which allows me to see the colour in a human-readable form and hex, but this requires specifying it in two places.

Lab and Lch colour support would be good. The former is not the most natural to think in sometimes, but is an intermediate step to Lch.

My understanding of colour theory is that the conversion should be done with a D50 illuminant. The python library colormath, while not usable in a JS lib, is useful for checking that the results are right.

HSV is not a perceptual colour space and would not solve this problem. HSV was designed for real-time calculations on 1970s and 1980s hardware, having to calculate hundreds or thousands of times a second. Tangram only needs to do the colour space conversion once on load, and runs on modern hardware.

@warpedgeoid
Copy link

Have you tried just using a global JavaScript function to do your color conversions? Instead of hard-coding a color in you styles, you would call this function with the parameters in whatever color space you are using.

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

No branches or pull requests

2 participants