Skip to content

Commit

Permalink
Handle dark mode for tooltips in docs (#60)
Browse files Browse the repository at this point in the history
* Handle dark mode

* Make legend examples match
  • Loading branch information
mkfreeman authored Nov 13, 2024
1 parent 4e66097 commit b301f9a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
28 changes: 28 additions & 0 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,31 @@
color: var(--vp-c-text-1);
text-decoration: underline;
}

/* Handling dark mode for tooltips, legends, strokes */

/* Define custom properties for dark mode */
:root.dark {
--background: 0, 0%, 10%; /* near-black */
--border: 0, 0%, 80%; /* light gray */
--text-color: 0, 0%, 90%; /* light color */
}
.dark g[aria-label="tip"] {
--plot-background: hsla(var(--background)) !important;
--plot-border: hsla(var(--border)) !important;
stroke: hsla(var(--border)) !important;
}

.dark g[aria-label="frame"] rect,
.dark rect[aria-label="frame"],
.dark g[aria-label="y-grid"],
.dark g[aria-label="y-grid"] > * {
stroke: hsla(var(--border)) !important;
}
.dark .dp-popover {
background-color: hsla(var(--background)) !important;
}
.dark .dp-categories-container,
.dark .dp-category {
border-color: hsla(var(--border)) !important;
}
9 changes: 7 additions & 2 deletions docs/legends.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ click on a legend item, all other items will be hidden.

```js
// Click on the legend to toggle visibility
duckPlot.table("stocks").x("Date").y("High").color("Symbol").mark("line");
duckPlot
.table("stocks")
.x("Date")
.y(["High", "Low"])
.color("Symbol")
.mark("line");
```

:::
Expand All @@ -27,7 +32,7 @@ interactiveLegend: false})`.
duckPlot
.table("stocks")
.x("Date")
.y("High")
.y(["High", "Low"])
.color("Symbol")
.mark("line")
.config({
Expand Down

0 comments on commit b301f9a

Please sign in to comment.