diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.css index 7d70474139..ecbd451b9c 100644 --- a/docs/.vitepress/theme/custom.css +++ b/docs/.vitepress/theme/custom.css @@ -23,12 +23,8 @@ color: var(--vp-c-text-2); } -:root.dark marker[stroke="white"] { - stroke: var(--vp-c-bg); -} - -:root.dark marker[fill="white"] { - fill: var(--vp-c-bg); +.vp-doc .plot { + --plot-background: var(--vp-c-bg); } .vp-doc :not(pre) > code { diff --git a/src/marker.js b/src/marker.js index 237da2f88a..f41c8aa211 100644 --- a/src/marker.js +++ b/src/marker.js @@ -58,7 +58,7 @@ function markerCircleFill(color, context) { .attr("markerWidth", 6.67) .attr("markerHeight", 6.67) .attr("fill", color) - .attr("stroke", "white") + .attr("stroke", "var(--plot-background)") .attr("stroke-width", 1.5) .call((marker) => marker.append("circle").attr("r", 3)) .node(); @@ -69,7 +69,7 @@ function markerCircleStroke(color, context) { .attr("viewBox", "-5 -5 10 10") .attr("markerWidth", 6.67) .attr("markerHeight", 6.67) - .attr("fill", "white") + .attr("fill", "var(--plot-background)") .attr("stroke", color) .attr("stroke-width", 1.5) .call((marker) => marker.append("circle").attr("r", 3)) diff --git a/src/marks/tree.js b/src/marks/tree.js index bed674b4af..e4a52e509d 100644 --- a/src/marks/tree.js +++ b/src/marks/tree.js @@ -22,7 +22,7 @@ export function tree(data, options = {}) { markerEnd = marker, dot: dotDot = isNoneish(markerStart) && isNoneish(markerEnd), text: textText = "node:name", - textStroke = "white", + textStroke = "var(--plot-background)", title = "node:path", dx, dy, diff --git a/src/plot.js b/src/plot.js index dfc8580fe4..e961c9fb40 100644 --- a/src/plot.js +++ b/src/plot.js @@ -219,6 +219,7 @@ export function plot(options = {}) { // Warning: if you edit this, change defaultClassName. svg.append("style").text( `.${className} { + --plot-background: white; display: block; height: auto; height: intrinsic; diff --git a/test/output/aaplBollinger.svg b/test/output/aaplBollinger.svg index ebe36d4c9c..678f30e8ce 100644 --- a/test/output/aaplBollinger.svg +++ b/test/output/aaplBollinger.svg @@ -1,6 +1,7 @@