-
Notifications
You must be signed in to change notification settings - Fork 82
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
Allow coord grammar to be specified for the color syntax #370
Conversation
Some non CSS level 4 color spaces need coordinate grammars that go beyond what is currently allowed for the color() syntax. For example the luv colorspace requires <percentage>[-1, 1] to be specified for its u and v coordinates. Other color spaces such as hsluv, hpluv, okhsl, okhsv have coordinates that are angles.
✅ Deploy Preview for colorjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Good, point, in CSS Color 4 the parameters of the [ <number> | <percentage> | none ]{3} so specifying polar spaces inside |
Not something to resolve in this PR, but I think this should be fixed in the spec. We should allow |
Hi there, apologies again for the delay, apparently I had seen this PR before, but it somehow completely fell off my radar. I'm …not quite sure what this is doing. Abstracting that block of code to a separate function seems like a useful refactor, but beyond that I'm not quite sure what new use cases it's enabling. A coord grammar can already be specified for |
Maybe I'm missing something but if you look at the current code the logic for handling the coord grammar is only executed for color space specific functions (oklab, oklch, lab, etc.). |
I think you might have missed the fact that the extracted code is now called in two places instead of one place in the original code. You can currently specify a coord grammar for the color function but it isn't used and that's what this PR fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, thanks! LGTM
One thing — I did not check if the code that was moved to the function was the same, did you make any changes there? |
I didn't make any changes to the code in the extracted function |
K, merged, thanks! |
Some non CSS level 4 color spaces need coordinate grammars that go beyond what is currently allowed for the color() syntax.
For example the luv color space requires [-1, 1] to be specified for its u and v coordinates. Other color spaces such as hsluv, hpluv, okhsl, okhsv have coordinates that are angles.