Skip to content

Colours ​

A colour is found in this order: setColor, then the one in the spec, then the palette.

Palette ​

ts
createChart(host, spec, { theme: { palette: ['#30466b', '#d1495b', '#2a9d8f'] } });

From code ​

ts
chart.setPalette(['#264653', '#e76f51', '#2a9d8f']);
chart.setColor('Last year', '#b8b4ad');  // a series, a slice, a group, an item
chart.resetColors();

Try it with the colour pickers of the playground.

One point ​

ts
{ name: 'Change', kind: 'bar', data: [42, -8], colors: [undefined, '#d1495b'] }

Theme ​

ts
const dark = { strong: '#f3f4f6', label: '#d1d5db', muted: '#9ca3af', grid: '#33383f', halo: '#1b1b1f', surface: '#1b1b1f' };
chart.update(spec, { theme: dark });

CSS variables work (color: 'var(--brand)') and are replaced by their value in exports.

MIT License