Skip to content

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

3 participants