Skip to content

HSL validation #5

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

Closed
slashwhatever opened this issue Mar 1, 2020 · 4 comments
Closed

HSL validation #5

slashwhatever opened this issue Mar 1, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@slashwhatever
Copy link

slashwhatever commented Mar 1, 2020

For color: hsl(12, 12%, 120)

The library classifies it as valid but Chrome and Firefox don't.

Edit: I have a PR ready to commit but I get an access denied when trying to create the pull request.

@dreamyguy
Copy link
Owner

Cheers for the heads up @slashwhatever. You'll need to clone the repo and create the pull request out of your cloned repo.

@slashwhatever
Copy link
Author

slashwhatever commented Mar 3, 2020 via email

@dreamyguy
Copy link
Owner

Oh, I meant fork the repo, not clone.

@dreamyguy dreamyguy added bug Something isn't working in progress This issue is being actively worked on labels May 22, 2020
@dreamyguy
Copy link
Owner

As I began my efforts on validating the upcoming CSS colors on #8, I chose to separate each color format into their own dedicated validation (all validations were contained in a single regular expression literal).

That led me to find quite a few problems with the HSL validation, that was quite weak.

I re-wrote it and now get the following (in relation to the former validation):

False positives (valid before, invalid now)

"rgb(-100, -10, 0 )"
"hsl(-100, -10, 0 )"
"hsl(1, 60%, 70)"
"hsl(100%, 100%, 100%)"
"hsl(12, 12%, 120)"
"hsla(100%, 100%, 100%, 1)"

False negatives (invalid before, valid now)

"hsl(180, 100%, 50%, 100%)"
"hsl(180deg, 100%, 50%)"
"hsl(180deg, 100%, 50%, 1)"
"hsl(180deg, 100%, 50%, 100%)"
"hsl(180 100% 50%)"
"hsl(180 100% 50% / 1)"
"hsl(180 100% 50% / 100%)"
"hsl(180deg 100% 50%)"
"hsl(180deg 100% 50% / 1)"
"hsl(180deg 100% 50% / 0.8)"
"hsl(180deg 100% 50% / .8)"
"hsl(180deg 100% 50% / 100%)"
"hsl(270 60% 70%)"
"hsl(270deg, 60%, 70%)"
"hsl(4.71239rad, 60%, 70%)"
"hsl(.75turn, 60%, 70%)"
"hsl(270, 60%, 50%, 15%)"
"hsl(270 60% 50% / .15)"
"hsl(270 60% 50% / 15%)"
"hsl(0deg, 60%, 70%)"
"hsl(1deg, 60%, 70%)"
"hsl(360deg, 60%, 70%)"
"hsl(0gra, 60%, 70%)"
"hsl(3gra, 60%, 70%)"
"hsl(120gra, 60%, 70%)"
"hsl(400gra, 60%, 70%)"
"hsl(0rad, 60%, 70%)"
"hsl(3rad, 60%, 70%)"
"hsl(5.29rad, 60%, 70%)"
"hsl(6.28rad, 60%, 70%)"
"hsl(.2turn, 60%, 70%)"
"hsl(.37turn, 60%, 70%)"
"hsl(.0turn, 60%, 70%)"
"hsl(0.0turn, 60%, 70%)"
"hsl(0.48turn, 60%, 70%)"
"hsl(1turn, 60%, 70%)"
"hsla(180, 100%, 50%, 100%)"
"hsla(180deg, 100%, 50%)"
"hsla(180deg, 100%, 50%, 1)"
"hsla(180deg, 100%, 50%, 100%)"
"hsla(180 100% 50%)"
"hsla(180 100% 50% / 1)"
"hsla(180 100% 50% / 100%)"
"hsla(180deg 100% 50%)"
"hsla(180deg 100% 50% / 1)"
"hsla(180deg 100% 50% / 0.8)"
"hsla(180deg 100% 50% / .8)"
"hsla(180deg 100% 50% / 100%)"

My changes are not pushed yet, but will be pushed by tomorrow. I'll mark this issue as solved, then.

@dreamyguy dreamyguy removed the in progress This issue is being actively worked on label Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants