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

allow native color functions with CSS vars as colors #1851

Closed
indfnzo opened this issue Sep 8, 2023 · 2 comments · Fixed by #1454
Closed

allow native color functions with CSS vars as colors #1851

indfnzo opened this issue Sep 8, 2023 · 2 comments · Fixed by #1454
Labels
enhancement New feature or request

Comments

@indfnzo
Copy link

indfnzo commented Sep 8, 2023

Closely related to #765.

It would be great if the isColor check supported native color functions with CSS vars inside. Some examples:

  • rgba(255, 0, 0, var(--a))
  • rgb(var(--rgb))
  • hsl(240deg 50% var(--l))
  • hsl(var(--hsl) / 50%)

Thanks!

@mbostock mbostock added the enhancement New feature or request label Sep 8, 2023
@mbostock
Copy link
Member

mbostock commented Sep 8, 2023

Agree. We are too strict in validating colors because we rely on d3-color which does not support CSS Level 4 d3/d3-color#96 and other modern enhancements to CSS. I think we could be much more lenient here, allowing anything that looks like it might be CSS, including rgba(…), hsl(…), lch(…), oklab(…), without strictly validating or trying to parse the string. (We still need to check against the X11 named colors though!)

@Fil
Copy link
Contributor

Fil commented Sep 13, 2023

See also #1454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants