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

Space-separated color params and aliases aren't parsed correctly #235

Open
claviska opened this issue Dec 13, 2022 · 1 comment
Open

Space-separated color params and aliases aren't parsed correctly #235

claviska opened this issue Dec 13, 2022 · 1 comment

Comments

@claviska
Copy link

This is an excellent library!

Thanks to a generous PR by @ajmchambers, TinyColor is now being used to power the color picker in Shoelace. 🎉

While reviewing the PR, I noticed a few small parsing blips that could be improved. On the website, the following space-separated color params fail to parse. All of the following are equivalent and should result in white @ 25% alpha, or #ffffff40.

rgb(255 255 255 / 25%) => #ffffffff
rgb(255 255 255 / .25) => #ffffffff

hsl(0 0% 100% / 25%)   => #ffffffff
hsl(0 0% 100% / .25)   => #ffffffff

The resulting values are all white, but with 100% instead of 25% alpha.

Similarly, rgba and hsla are effectively aliases of rgb and hsl now, but alpha is only considered when the alias is used.

rgb(255, 255, 255, 25%)  => #ffffffff
rgb 255 255 255 .25      => #ffffffff

rgba(255, 255, 255, 25%) => #ffffff40
rgba 255 255 255 .25     => #ffffff40

Let me know if you need any additional info on this!

@scttcper
Copy link
Owner

This feels like it might be a breaking change if we start parsing these differently, but the reason makes sense

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