Guides

Theming and dark mode

Style every chart through CSS variables

Every default color in vccs comes from a CSS variable with a fallback. Set the variables on any parent element, and charts follow your theme, including dark mode, without overriding SVG attributes.

.dashboard {
  --v-charts-grid: #e4e4e7;
  --v-charts-text: #71717a;
}
.dark .dashboard {
  --v-charts-grid: #27272a;
  --v-charts-text: #a1a1aa;
}

Series colors

A series without its own color takes the next palette color. Map the palette to your design system once, for example to the shadcn-vue chart colors:

:root {
  --v-charts-series-1: var(--chart-1);
  --v-charts-series-2: var(--chart-2);
  --v-charts-series-3: var(--chart-3);
}

How the palette is assigned:

  • Series charts (Area, Bar, Line, Scatter, Radar) count series in the order they register. A series with an explicit color still takes its place in the count.
  • Pie, Funnel and RadialBar count entries. Treemap counts top-level groups; Sunburst children inherit the color of their top-level branch.
  • After eight colors the palette repeats. Set --v-charts-series alone to give every series the same color.

Explicit color props accept variables too:

<Bar data-key="desktop" fill="var(--chart-1)" />

Tokens

TokenUsed forFallback
--v-charts-gridgrid lines, polar grid, reference lines and areas#ccc
--v-charts-axisaxis lines, tick lines, brush and error-bar strokes#666
--v-charts-texttick labels and text#666 (ticks), #808080 (Text)
--v-charts-cursortooltip cursor line and band#ccc
--v-charts-mutedbar and radial bar backgrounds; empty Tracker, calendar, Heatmap and CohortChart cells#eee (backgrounds), #e5e5e5 (Tracker), #ebedf0 (calendar), #eef2f7 (Heatmap, CohortChart)
--v-charts-backgrounddot fills and separators between sectors and nodes#fff
--v-charts-seriesfallback for every numbered series token#2563eb for series 1
--v-charts-series-1palette color 1#2563eb
--v-charts-series-2palette color 2#f97316
--v-charts-series-3palette color 3#14b8a6
--v-charts-series-4palette color 4#a855f7
--v-charts-series-5palette color 5#f59e0b
--v-charts-series-6palette color 6#ec4899
--v-charts-series-7palette color 7#06b6d4
--v-charts-series-8palette color 8#84cc16
--v-charts-status-up, -degraded, -down, -maintenanceTracker status colors#22c55e, #f59e0b, #ef4444, #3b82f6
--v-charts-inactivehidden legend items#a3a3a3
--v-charts-focuskeyboard focus outlineHighlight
--v-charts-tooltip-backgrounddefault tooltip background#fff
--v-charts-tooltip-borderdefault tooltip border#ccc
--v-charts-label-foregroundtext on filled cells and Treemap nodesautomatic black/white for known opaque fills; otherwise currentColor
--v-charts-tooltip-foregrounddefault tooltip text#000

Numbered tokens resolve as var(--v-charts-series-N, var(--v-charts-series, palette-color)). Single-color charts use series 1. chartThemeTokens exports the token names.

Class names

Every rendered part has a stable class with the v-charts- prefix, for example .v-charts-bar-rectangle, .v-charts-cartesian-axis-tick-value or .v-charts-tooltip-wrapper. Use them for anything the tokens do not cover.

Text on fills

Default Treemap palette labels use a contrasting foreground for the palette color. When overriding series tokens, set --v-charts-label-foreground against your fill. Known opaque colors use whichever of #ffffff and #0a0a0a has higher contrast. For CSS variables, color mixes and translucent fills, set --v-charts-label-foreground on the chart or a cell's parent. Choose it against the resolved, composited fill in both themes. A variable's fallback does not establish its actual color. The override also takes precedence over the automatic choice for opaque fills. Tooltip text uses --v-charts-tooltip-foreground; series colors appear as swatches. BarList text inherits your page color, with the bar color limited to an 18% tint.

Copyright © 2026