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
Section titled “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
Section titled “Properties”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
Section titled “colors”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
Section titled “negative”negative:
string
Defined in: types/index.ts:48
Semantic colour for “bad”/“down” values.
onAccent
Section titled “onAccent”onAccent:
string
Defined in: types/index.ts:50
Foreground for text drawn on top of accent fills (e.g. labels inside bars).
positive
Section titled “positive”positive:
string
Defined in: types/index.ts:46
Semantic colour for “good”/“up” values (waterfall, deltas).
surface
Section titled “surface”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
Section titled “textMuted”textMuted:
string
Defined in: types/index.ts:42
Secondary text for muted axis labels and dimmed legend entries.
tooltipBg?
Section titled “tooltipBg?”
optionaltooltipBg?:string
Defined in: types/index.ts:57
Tooltip panel background. Optional — falls back to Theme.surface.
Accepts any CSS colour (#rrggbbaa for translucency).
tooltipBorder?
Section titled “tooltipBorder?”
optionaltooltipBorder?:string
Defined in: types/index.ts:61
Tooltip panel border. Optional — falls back to Theme.axis.
tooltipText?
Section titled “tooltipText?”
optionaltooltipText?: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.