Overview
Apache ECharts provides powerful customization capabilities through built-in themes, custom color palettes, and comprehensive styling options. This guide covers how to apply themes and customize the visual appearance of your charts.Built-in Themes
ECharts includes over 30 pre-built themes that you can use out of the box. Themes are located in thetheme/ directory and can be registered using echarts.registerTheme().
Available Themes
Some popular built-in themes include:dark- Dark mode theme with high contrastvintage- Retro color palette with warm tonesmacarons- Soft pastel colorsinfographic- Bold colors for infographicsshine- Bright, vibrant colorsroma- Roma color scheme- And many more:
azul,blue,caravan,cool,forest,fresh-cut,fruit,green,jazz,london,royal, etc.
Registering and Using Themes
Themes are registered using the UMD pattern and work in AMD, CommonJS, and browser environments.Dark Theme Example
The dark theme (fromtheme/dark.js) provides a complete dark mode experience:
Vintage Theme Example
The vintage theme offers a simple, retro color scheme:Creating Custom Themes
You can create your own theme by defining a theme object and registering it:Color Customization
Direct Color Configuration
You can override theme colors directly in the chart option:Dynamic Colors with Functions
Use callback functions for dynamic color assignment:Gradient Colors
Component Customization
Axis Styling
Customize axis appearance from theme configurations (as seen intheme/dark.js):
DataZoom Styling
Best Practices
Theme Priority
Theme settings are overridden by option settings. Use themes for base styling and options for specific customizations.
Color Contrast
Ensure sufficient contrast between colors, especially for dark themes. The dark theme uses
#B9B8CE text on #100C2A background.Consistency
Use consistent color palettes across related charts. Register a common theme for your application.
Accessibility
Consider colorblind-friendly palettes and provide sufficient visual distinction beyond color alone.
Next Steps
Responsive Design
Learn how to make your charts responsive across different screen sizes
Accessibility
Implement ARIA labels and accessibility features