ECharts themes ESM pack with TypeScript support.
npm install echarts-themesyarn add echarts-themespnpm add echarts-themes- Built-in TypeScript API for official ECharts themes
- Includes all themes from apache/echarts-theme-builder
- Metadata for each theme, including
name,title, anddarkMode
import { registerTheme, use } from 'echarts/core'
import { BarChart } from 'echarts/charts'
import { GridComponent, TooltipComponent } from 'echarts/components'
import { CanvasRenderer } from 'echarts/renderers'
import {
getThemeBundle,
getTheme,
getThemeMeta,
listThemeNames,
findThemes,
} from 'echarts-themes'
use([CanvasRenderer, BarChart, GridComponent, TooltipComponent])
const names = listThemeNames()
const dark = getTheme('dark')
const darkMeta = getThemeMeta('dark')
const darkBundle = getThemeBundle('dark')
registerTheme(darkMeta.name, dark)
registerTheme(darkBundle.meta.name, darkBundle.theme)
const darkModeThemes = findThemes({ darkMode: true })listThemeNames()listThemeBundles()listThemeMetas()getTheme(name)getThemeMeta(name)getThemeBundle(name)hasTheme(name)findThemes(query)
Also exports per-theme constants such as themeDark, themeDefault, themeV5, etc.
Returns all built-in theme names.
- Return type:
readonly ThemeName[] - Default behavior: no arguments, returns the full list
- Runtime behavior: each call returns a new array view
Returns all built-in theme bundles.
- Return type:
readonly ThemeBundle[] - Default behavior: no arguments, returns the full list
- Runtime behavior: each call returns a new array view; bundle objects are immutable
Returns metadata of all built-in themes.
- Return type:
readonly ThemeMeta[] - Default behavior: no arguments, returns the full list
- Runtime behavior: each call returns a new array view; metadata objects are immutable
Checks whether a string is a valid built-in theme name.
- Parameters:
name: stringtheme name candidate
- Return type:
boolean(type guard)
Returns an ECharts theme object by name.
- Parameters:
name: ThemeNamebuilt-in theme name
- Return type:
ThemeObject - Runtime behavior: returned object is immutable
Returns metadata by theme name.
- Parameters:
name: ThemeNamebuilt-in theme name
- Return type:
ThemeMeta
Returns full theme bundle by name.
- Parameters:
name: ThemeNamebuilt-in theme name
- Return type:
ThemeBundle
Filters themes by metadata.
- Parameters:
query.darkMode?: boolean- default:
undefined(disabled) - behavior: when set, filters by dark-mode flag
- default:
query.names?: readonly string[]- default:
undefined(disabled) - behavior: case-insensitive match after
trim()andtoLowerCase() - whitespace-only entries are ignored
- default:
- Return type:
readonly ThemeBundle[]
Union-like compile-time type derived from built-in theme names.
Record<string, unknown> theme payload for echarts.registerTheme.
Color string type, typically CSS-compatible values like hex/rgb/rgba.
Raw source JSON shape:
version: number | stringthemeName: stringtheme: ThemeObject
Enriched metadata shape:
name: stringtitle: stringsource: 'apache/echarts-theme-builder'darkMode: boolean(default false when no usable background color)backgroundColor?: ThemeColorcolorPalette?: ThemeColor[]
Theme package shape:
meta: ThemeMetatheme: ThemeObjectraw: OfficialThemeFile
Query parameters for findThemes:
darkMode?: booleannames?: readonly string[]
chalk, dark, default, essos, halloween, infographic, macarons, purple-passion, roma, shine, v5, vintage, walden, westeros, wonderland