Skip to content

Theme

Defined in: types/index.ts:32

A complete colour palette for the chart surface.

Pass a Theme object directly to any chart’s theme config field, or register one by name with addTheme(name, theme) and reference it as a string.

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

axis: string

Defined in: types/index.ts:44

Axis stroke colour.


bg: string

Defined in: types/index.ts:34

Page background. Used to fill the canvas before drawing.


colors: string[]

Defined in: types/index.ts:52

Series palette. Indexed modulo length for charts with more series than colours.


grid: string

Defined in: types/index.ts:38

Grid line stroke colour. Use a translucent value.


negative: string

Defined in: types/index.ts:48

Semantic colour for “bad”/“down” values.


onAccent: string

Defined in: types/index.ts:50

Foreground for text drawn on top of accent fills (e.g. labels inside bars).


positive: string

Defined in: types/index.ts:46

Semantic colour for “good”/“up” values (waterfall, deltas).


surface: string

Defined in: types/index.ts:36

Card surface drawn behind the plot area.


text: string

Defined in: types/index.ts:40

Primary text colour for titles, labels, tick numbers.


textMuted: string

Defined in: types/index.ts:42

Secondary text for muted axis labels and dimmed legend entries.


optional tooltipBg?: string

Defined in: types/index.ts:57

Tooltip panel background. Optional — falls back to Theme.surface. Accepts any CSS colour (#rrggbbaa for translucency).


optional tooltipBorder?: string

Defined in: types/index.ts:61

Tooltip panel border. Optional — falls back to Theme.axis.


optional tooltipText?: string

Defined in: types/index.ts:66

Tooltip primary text (title and values). Optional — falls back to Theme.text. Muted/label text and the footer separator are derived from Theme.textMuted.