Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apache/echarts/llms.txt
Use this file to discover all available pages before exploring further.
Creating Custom Themes
Creating custom themes allows you to match ECharts visualizations to your brand guidelines, application design system, or personal preferences.Theme Structure
A theme is a JavaScript object that defines styling for various chart components. Here’s the complete structure:Complete Custom Theme Example
Here’s a complete example of a custom corporate theme based on the source code patterns:/workspace/source/theme/macarons.js, /workspace/source/theme/dark.js
Creating a Dark Theme
Based on the official dark theme source code, here’s how to create a dark theme:/workspace/source/theme/dark.js:44-223
Theme Distribution Formats
When distributing themes, use the UMD pattern for maximum compatibility:/workspace/source/theme/dark.js:20-43
Theme Options Reference
Color Palette
Thecolor array defines the default colors used for series data:
Axis Styling
All axis types share similar styling options:/workspace/source/theme/dark.js:46-69, /workspace/source/theme/macarons.js:119-149
Line Series Styling
/workspace/source/theme/macarons.js:163-167
Candlestick Styling
/workspace/source/theme/dark.js:212-219, /workspace/source/theme/macarons.js:169-183
Gauge Styling
/workspace/source/theme/macarons.js:211-238
Best Practices
1. Consistent Color Palette
Choose 5-10 distinct colors that work well together:2. Accessibility
Ensure sufficient contrast between text and backgrounds:3. Dark Mode Indicator
SetdarkMode: true for dark themes:
/workspace/source/theme/dark.js:83
4. Component Consistency
Apply similar styling to related components:/workspace/source/theme/dark.js:46-69, /workspace/source/theme/dark.js:196-199
5. Testing
Test your theme with different chart types:Exporting Themes
Save your theme as a separate JavaScript file for reuse:Next Steps
- Built-in Themes - Explore existing themes for inspiration
- Theming Overview - Learn more about the theming system