Theming
All chart colours, inks and surfaces are CSS variables defined in core/charts.css. Charts reference roles (var(--clui-s1), var(--clui-grid)), never raw colours, so re-theming is a CSS change.
Dark mode
Charts switch to dark tokens when any ancestor has:
- the class
dark(Tailwind, shadcn/ui, next-themes withattribute="class"), or data-theme="dark"(next-themes withattribute="data-theme").
You can also force a mode per chart or per region:
<LineChart mode="dark" … /> // this chart only
<LineChart mode="auto" … /> // follow prefers-color-scheme
<div className="clui-light">…</div> // everything inside is light, even on a dark page
<div className="clui-dark">…</div> // everything inside is darkDark mode is not an automatic inversion. Every colour has a separately chosen dark step, checked against the dark surface.
Re-branding
Override variables on .clui (or on a scope class) after importing charts.css:
.clui {
--clui-font: "Inter", system-ui, sans-serif;
--clui-s1: #5b4cf0; /* accent / first series */
--clui-surface: #fcfcfb; /* chart background */
}
.dark .clui {
--clui-s1: #8b80f5;
--clui-surface: #141414;
}Token reference
| Token | Role |
|---|---|
--clui-font |
Font family (default inherit: your app's font) |
--clui-surface |
Chart background; also the gap colour between touching marks |
--clui-ink, --clui-ink-2, --clui-ink-3 |
Primary, secondary and muted text |
--clui-grid, --clui-axis |
Gridlines; zero line and axis ticks |
--clui-s1 … --clui-s8 |
Categorical series colours, in fixed order |
--clui-s1-ink … --clui-s8-ink |
Text colour for labels placed inside a series fill |
--clui-context, --clui-context-soft |
Grey for context series and "Other" |
--clui-good, --clui-bad, --clui-neutral |
Favorable / unfavorable / no-change marks |
--clui-good-text, --clui-bad-text |
Text versions (higher contrast) |
--clui-total |
Totals in waterfalls, nodes in sankeys |
--clui-forecast-bg, --clui-partial-bg |
Shading for forecast and partial periods |
--clui-seq-1 … --clui-seq-7 |
Sequential ramp (heatmaps), with matching -ink tokens |
--clui-div-n3 … --clui-div-p3 |
Diverging ramp around a neutral grey --clui-div-0 |
Colour rules
- Categorical colours are assigned in order and never cycled. The ninth series is grey and the chart adds a note. Use small multiples or group into "Other".
- Colour follows the series, not its rank or visibility. Hiding a series from the legend never repaints the others.
- Emphasis by default: pass
highlightto colour one or two series and draw the rest in grey context. - Good and bad follow
favorable, not the sign. A fall in cost is favorable whenfavorable="down". - Text never uses series colours (they're too light for text on white). Labels use ink tokens, and a coloured swatch carries identity.
The default categorical order passes colour-vision-deficiency separation checks for adjacent series in both modes. If you swap hues, keep that property: validate adjacent pairs under protanopia, deuteranopia and tritanopia simulation.
Per-series colours
Any series accepts color, with any CSS colour or token:
series={[
{ key: "actual", label: "Actual" },
{ key: "plan", label: "Plan", color: "var(--clui-context)", dashed: true },
]}A series with an explicit colour doesn't use up a palette slot, so the next series still gets --clui-s1.