# Theme

The library supports dark and light themes. Use the [`theme`](../api/interfaces/Charting_Library.ChartingLibraryWidgetOptions.md#theme) parameter in [Widget Constructor](https://charting-library-docs.xstaging.tv/latest/configuration/Widget-Constructor.md) to specify a theme. The default value is `light`. The chart layout does not contain buttons to switch the theme in the UI. Therefore, users cannot switch the theme unless you develop this option outside the library.

:::tip

If you want to override the default colors of the light and dark themes, you can use the [Custom themes API](https://charting-library-docs.xstaging.tv/latest/customization/styles/custom-themes.md).

:::

## Theme switching

You should switch the chart's theme when the theme of your website changes. To do this, use the [`changeTheme`](../api/interfaces/Charting_Library.IChartingLibraryWidget.md#changetheme) method that changes the theme on the fly.

```javascript
widget.chartReady().then(function() {
    widget.changeTheme("dark");
});
```

You can call the [`getTheme`](../api/interfaces/Charting_Library.IChartingLibraryWidget.md#gettheme) method to get the current theme.

Note that the `theme` value is stored in the chart's configuration. Therefore, if you restore the chart that has the dark theme, you may see a black chart background in the light theme. In this case, you should apply the theme once again using the [`changeTheme`](../api/interfaces/Charting_Library.IChartingLibraryWidget.md#changetheme) method.

![Theme is not fully applied](/img/theme-issue.png)

---

## Sitemap

- [All documentation pages](https://charting-library-docs.xstaging.tv/llms.txt)
- [Full page map with headings](https://charting-library-docs.xstaging.tv/docs_map.md)
