Skip to content

consider var(--foo) a color #766

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

Merged
merged 1 commit into from
Feb 17, 2022
Merged

consider var(--foo) a color #766

merged 1 commit into from
Feb 17, 2022

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Feb 17, 2022

Fixes #765. It could be stricter (checking that the variable name starts with -- for example), but I think this is fine as is.

Screen Shot 2022-02-17 at 10 37 22 AM

Plot.plot({
  style: "--red: red;",
  y: {
    grid: true
  },
  marks: [
    Plot.areaY(AAPL, {x: "Date", y: "Close", fillOpacity: 0.1}),
    Plot.line(AAPL, {x: "Date", y: "Close", stroke: "var(--red)"}),
    Plot.ruleY([0])
  ]
})

@mbostock mbostock requested a review from Fil February 17, 2022 18:35
@mbostock mbostock merged commit 4663ef3 into main Feb 17, 2022
@mbostock mbostock deleted the mbostock/css-var branch February 17, 2022 18:53
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 this pull request may close these issues.

Support CSS variables as colors
2 participants