Chart theming
An organisation's colours for its charts: set once around a page of charts, kept to the parts of a chart where colour is a choice and not a meaning.
What a theme changes
What a theme can change: colour in four roles, the words and formats, and the font. And what it can't.
Preview
The same charts under a theme built from the switches. Parameter colours stay put unless a theme names them; the palette moves the series, the ramps move the gradients; language, formats and font reach every chart's own text.
Series: palette
Gradient: ramps.parameters.oxygen
Gradient: ramps.sequential
Classes: ramps.classes
Series: the first palette colour
Usage
The theme is a ChartTheme from @kystdata/figures, re-exported from @kystdata/ui/charts and validated there, so the same object is stored, edited and drawn. Layers merge per part: the platform's, the organisation's, then a figure's.
<ChartThemeProvider theme={mergeChartThemes(organisation.chartTheme, figure.theme)}>
<BarChart ... />
<IsoplethChart ... />
</ChartThemeProvider> {
palette?: string[]; // 3–12 hex colours
parameters?: Record<string, string>; // parameter key → hex
ramps?: {
parameters?: Record<string, ColourRampId>; // greens, coolWarm, blues, rainbow, viridis
sequential?: ColourRampId; // depth, time, intensity
classes?: 'jet' | 'blues'; // rose speed classes
};
locale?: {
language?: 'en' | 'nb'; // the chart's own words
decimal?: ',' | '.';
dates?: 'dd.mm.yyyy' | 'yyyy-mm-dd';
};
font?: 'arial' | 'inter' | 'roboto' | 'source-sans-3' | 'ibm-plex-sans' | 'instrument-sans';
}