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

Fails to parse "modern rgb syntax" and some other valid colors #174

Open
sbj42 opened this issue May 21, 2024 · 0 comments
Open

Fails to parse "modern rgb syntax" and some other valid colors #174

sbj42 opened this issue May 21, 2024 · 0 comments

Comments

@sbj42
Copy link

sbj42 commented May 21, 2024

A color in "legacy rgb syntax" with no alpha (e.g. rgb(255, 255, 255)) appears to be properly handled by parseColor. However there are other valid color formats that are not handled.

See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgb#formal_syntax

The following valid CSS colors are not parsed properly by parseColor:

  • rgb(255 255 255)
  • rgb(255 255 255 / 0.5)
  • rgb(255 255 255 / 50%)
  • rgb(255 255 255 / none)
  • rgb(255, 255, 255, 0.5)
  • rgb(255, 255, 255, 50%)
  • rgb(255 100% 100%)
  • rgb(255 none none)

Note all of those should also work with rgba(), as it has the same syntax as rgb() - e.g. the alpha value is optional in both.

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

1 participant