Skip to content
peakcharts

Theming

Light and dark ship in the box. Everything else is a CSS variable you can override.

Dark mode

Add data-theme="dark" to a parent element. The chart does not read prefers-color-scheme by itself, so toggle the attribute from your own theme logic.

tsx
<div data-theme="dark">
  <BarChart title="Revenue" data={data} />
</div>
Revenue by month
Revenue by monthClick a mark to pin its value; click it again to release. Keyboard: Enter or Space to pin, Escape to release. Data table below.021426384JanFebMarAprMayJunJan: 32Feb: 46Mar: 63Apr: 58May: 71Jun: 84
Click a mark to pin its value
View data
Revenue by month
LabelValue
Jan32
Feb46
Mar63
Apr58
May71
Jun84

The site toggle in the header does exactly this: it sets the attribute on the root element, and every chart on the page follows.

Match your app

To match your app, override these variables on .pc-chart:

css
.pc-chart {
  --pc-surface: #ffffff;
  --pc-ink: #0b1a20;
  --pc-muted: #52646c;
  --pc-grid: #dce4e8;
}

Font

peakcharts/styles.css bundles DM Sans through @fontsource, so nothing is requested from Google Fonts. Set font-family on .pc-chart to use your own.