Skip to content

addTheme

addTheme(name, theme): void

Defined in: core/themes.ts:156

Register a named theme so charts can reference it via theme: '<name>'.

Custom themes can override any subset of the Theme fields. Semantic fields (positive/negative/onAccent) are backfilled from defaults if omitted.

Re-exported from @arshad-shah/swift-chart/react so React-only consumers can register themes without importing the core entry.

string

Identifier used as theme: '<name>' on chart configs. Must be unique; reusing a built-in name (midnight, arctic, ember, forest) replaces it globally.

Theme

Theme palette and semantic colours.

void

import { addTheme, LineChart } from '@arshad-shah/swift-chart';
addTheme('neon', {
bg: '#0a0a0f', surface: '#111118', grid: '#ffffff08',
text: '#e0e0ff', textMuted: '#6060a0', axis: '#2a2a4a',
colors: ['#ff00ff', '#00ffff', '#ffff00', '#ff6600'],
});
new LineChart('#chart', { theme: 'neon' });