-
Notifications
You must be signed in to change notification settings - Fork 547
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
Bug report: New CSS color formats/syntax unknown #297
Bug report: New CSS color formats/syntax unknown #297
Comments
Is this something that could be looked at? @gka |
I'd open a pull request if I had more experience with this package and colours in general. This really tripped me up when trying to debug why https://github.com/larsenwork/postcss-easing-gradients was failing on certain colour values, and specifically |
I'm struggling with the same issue. |
I believe this is fixed in v3.0.0 which got released today. We also added support for parsing However, I just saw that the alpha channel is also supported as a percentage, which chroma.js currently does not support. Will leave this open until the full syntax is supported. |
I am getting this error when using a very common (newer) CSS color syntax.
The errors
rgb(255 0 0)
throwsUncaught Error: unknown format: rgb(255 0 0)
rgb(255 0 0 / .5)
throwsUncaught Error: unknown format: rgb(255 0 0 / .5)
hsl(240deg 100% 50%)
throwsUncaught Error: unknown format: hsl(240deg 100% 50%)
hsl(240deg 100% 50% / 25%)
throwsUncaught Error: unknown format: hsl(240deg 100% 50% / 25%)
These would be their older equivalents
rgb(255, 0, 0)
→ *rgb(255 0 0)
rgba(255, 0, 0, .5)
→ *rgb(255 0 0 / .5)
hsl(240, 100%, 50%)
→ *hsl(240deg 100% 50%)
hsla(240, 100%, 50%, .25)
→ *hsl(240deg 100% 50% / 25%)
This new syntax and its different nuances should be supported. In many browsers, this new color syntax is already the default.
Gotchas
.25
and25%
are accepted values and are treated the same.rgb
vs.rgba
), so these would also work and be treated the same:hsla(240, 100%, 50%, .25)
===hsla(240deg 100% 50% / .25)
===hsl(240deg 100% 50% / .25)
The text was updated successfully, but these errors were encountered: