-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Color operations #479
Color operations #479
Conversation
With this color library, we're back where we were in the beginning, with color parsing taking the biggest part of the whole bundled code (about 38kb uncompressed). This is up from 10 lines of code with a canvas hack @tmcw. If we're implementing color functions and keeping a relatively lightweight color-parser-js, let's at least implement functions ourselves, because harthur/color is really too bloated to be used in a browser library. |
@mourner - I'm not following how this is related to replacing the Canvas hack - was there some way the Canvas hack would solve color operations other than the 'mix' operation'? You could possibly try to use it for fade, but canvas's behavior with low opacity values is very irregular. Let's port carto's simple operations first - this will cover everything but interpolating in different spaces, and for that we would probably use something like d3's color spaces or my color-system project, that just does color systems. |
@tmcw no, I'm just explaining why I was so compelled to replace the color суббота, 21 июня 2014 г. пользователь edenh написал:
Vladimir Agafonkin |
Hrm, I'm curious if we really want to support this as part of the core style spec. It puts a pretty high demand on implementers (of course only JS/native atm) and no other formats I know of support this kind of thing natively. This seems more like preprocessor/editor territory to me. |
Good point, I agree. This is only useful when writing most styles by hand. |
Closing for now. |
This is a failing test that demonstrates the issue: it would need a fix - specifically a removal of the unknown key behavior at the root object - to pass. I think we should tolerate extra keys in style objects because they're very useful for the editor use case, like if you want to store extra data for color transforms etc., that is not handled by the gl renderer directly (see mapbox/mapbox-gl-js#479 ) The only potential drawback I see here is if gl-native's parsing behavior would have problems with additional data, but it seems very unlikely.
ref mapbox/mapbox-gl-style-spec#38
Replaces https://github.com/deanm/css-color-parser-js with https://github.com/harthur/color to allow for color operations:
Syntax example:
Note: values cannot yet be constants
@ansis @mourner @kkaefer can someone please review?