v0.4.0

API · Themes

Themes

ThemeConfig

Theme configuration type for chart colors, palette, and typography. Used by ChartGPUOptions.theme.

PropertyDescription
backgroundColorCanvas background
textColorAxis labels, legend
axisLineColor, axisTickColor, gridLineColorAxis/grid styling
colorPaletteDefault series colors (when series.color not set)
fontFamily, fontSizeText styling

See types.ts.

Presets

  • 'dark'
    (default), 'light' — string presets
  • darkTheme, lightTheme
    exported ThemeConfig objects
  • getTheme(name)
    returns preset by name

Usage

TypeScript
// Preset
theme: 'dark' | 'light'

// Partial override (merges onto dark)
theme: { backgroundColor: '#1e1e2e', colorPalette: ['#ff6b9d'] }

// Palette-only (replaces theme.colorPalette)
theme: 'dark', palette: ['#FF6384', '#36A2EB']

Color precedence: lineStyle.color / areaStyle.color > series.color > theme.colorPalette.

API reference for the linked @chartgpu/chartgpu package (v0.4.0). Source on GitHub.