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

Support grad, rad, and turn angle units for the hue value of hsl() #311

Closed
straker opened this issue May 11, 2023 · 3 comments · Fixed by #324
Closed

Support grad, rad, and turn angle units for the hue value of hsl() #311

straker opened this issue May 11, 2023 · 3 comments · Fixed by #324

Comments

@straker
Copy link

straker commented May 11, 2023

I'd like to be able to pass any of the 4 hue angle units (deg, grad, rad, and turn) to the new Color(str) constructor, but at the moment only deg works.

new Color('hsl(90deg 40% 50%)') // works
new Color('hsl(100grad 40% 50%)') // throws
new Color('hsl(1.57rad 40% 50%)')  // throws
new Color('hsl(0.25turn 40% 50%)') // throws
@Crissov
Copy link

Crissov commented May 12, 2023

See issue #180 and PR #181. I kinda lost interest back then.

@WilcoFiers
Copy link

@LeaVerou FYI here; This issue came from us trying to adopt Color.js into axe-core. Axe currently has its own color conversion code, but with new color spaces & syntax available in CSS 4 we needed something a little more robust. Time permitting, we'll try to contribute to help address issues.

This isn't going to increase the Color.js weekly installs number on NPM. Axe-core embeds its dependencies, but it'll be there. I'm curious if there are any considerations on using Color.js in axe-core?

You can see the PR for adding Color.js into axe-core here if you're curious: dequelabs/axe-core#4020

@LeaVerou
Copy link
Member

We're happy to merge a PR to support other angle units.

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

Successfully merging a pull request may close this issue.

4 participants