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.

Example

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' });

Properties

axis

axis: string

Defined in: types/index.ts:44

Axis stroke colour.


bg

bg: string

Defined in: types/index.ts:34

Page background. Used to fill the canvas before drawing.


colors

colors: string[]

Defined in: types/index.ts:52

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


grid

grid: string

Defined in: types/index.ts:38

Grid line stroke colour. Use a translucent value.


negative

negative: string

Defined in: types/index.ts:48

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


onAccent

onAccent: string

Defined in: types/index.ts:50

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


positive

positive: string

Defined in: types/index.ts:46

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


surface

surface: string

Defined in: types/index.ts:36

Card surface drawn behind the plot area.


text

text: string

Defined in: types/index.ts:40

Primary text colour for titles, labels, tick numbers.


textMuted

textMuted: string

Defined in: types/index.ts:42

Secondary text for muted axis labels and dimmed legend entries.