Styling and Themes
Highcharts provides powerful styling capabilities through CSS, inline styles, and pre-built themes to customize the visual appearance of your charts.Overview
You can style Highcharts in two primary ways:- Inline styles: Using JavaScript configuration options
- Themes: Applying pre-built or custom theme files
Using Pre-built Themes
Highcharts includes several professionally designed themes that can be applied to your charts.Available Themes
- DarkUnica: Dark theme with gradient background
- Grid: Clean grid-based design
- Avocado: Fresh, modern color scheme
- Sunset: Warm color palette
- High Contrast Dark/Light: WCAG-compliant high contrast themes
- Brand Dark/Light: Professional brand themes
Applying a Theme
Themes are applied using theHighcharts.setOptions() method:
Themes must be loaded before creating any charts to ensure all options are applied correctly.
Custom Styling
Chart Background and Colors
Customize the chart’s color scheme and background:Title and Subtitle Styling
Axis Styling
Customize axis lines, labels, and grid lines:Series and Data Label Styling
Creating a Custom Theme
Create your own theme by defining a comprehensive options object:CSS Styling Mode
Enable styled mode to use pure CSS for styling:1
Enable Styled Mode
Set
styledMode: true in your chart configuration:2
Include CSS
Include Highcharts CSS file:
3
Customize with CSS
Override styles in your own CSS:
Theme Examples from Source
The DarkUnica theme (fromts/Extensions/Themes/DarkUnica.ts:44-239) demonstrates a complete theme implementation:
Best Practices
Performance Tips
- Apply themes once at application startup
- Use CSS styling mode for better performance with multiple charts
- Keep custom themes in separate files for maintainability