# Themes A theme is a named configuration object that Vega-Lite applies while compiling a specification. Themes set defaults for colors, marks, axes, legends, fonts, and other visual properties. They apply to Vega-Lite input only because Vega input skips Vega-Lite compilation. For Vega input, pass a configuration object directly with `config` or `--config`. VlConvert bundles the themes from the `vega-themes` package. Select a theme per conversion, or set `default_theme` in the converter configuration. Every conversion example and image on this page uses this Vega-Lite specification. Save it as follows: :::{dropdown} chart.vl.json :open: ```{literalinclude} /_examples/theme-demo.vl.json :language: json ``` ::: ## Use a Built-In Theme Themes included in `vega-themes` can be referenced by name. Visit the [theme explorer](https://vega.github.io/vega-themes/) to preview available themes. Set `theme` beside `spec` in a Vega-Lite conversion request. Save this body as `request.json`: :::{dropdown} request.json :open: ```{literalinclude} /_generated/requests/theme-dark.json :language: json ``` ::: Send it to the SVG endpoint: ```console $ curl http://127.0.0.1:3000/vegalite/svg \ > -H 'Content-Type: application/json' \ > --data-binary @request.json \ > --output chart.svg ``` The same chart with the default configuration and with the `dark` theme: ::::{grid} 1 1 2 2 :gutter: 3 :::{grid-item} ```{vl-chart} /_examples/theme-demo.vl.json :alt: Stacked bar chart of revenue by quarter with the default configuration ``` ::: :::{grid-item} ```{vl-chart} /_examples/theme-demo.vl.json :theme: dark :alt: The same stacked bar chart with the dark theme ``` ::: :::: ## List and Inspect Themes `GET /themes` lists the available names, and `GET /themes/{name}` returns the configuration one theme applies: ```console $ curl http://127.0.0.1:3000/themes $ curl http://127.0.0.1:3000/themes/dark ``` ## Register a Custom Theme A custom theme file is a JSON object whose keys are theme names and whose values are Vega configuration objects. Save this example as `themes.json`: :::{dropdown} themes.json :open: ```{literalinclude} /_examples/themes.json :language: json ``` ::: A custom theme replaces a built-in theme with the same name. Register custom themes when starting the server: ```console $ vl-convert serve \ > --themes themes.json \ > --port 3000 ``` The themes then appear in `GET /themes` and can be selected by Vega-Lite conversion requests. Save this request as `request.json`: :::{dropdown} request.json :open: ```{literalinclude} /_generated/requests/theme-brand.json :language: json ``` ::: ```console $ curl http://127.0.0.1:3000/vegalite/svg \ > -H 'Content-Type: application/json' \ > --data-binary @request.json \ > --output chart.svg ``` The `brand` theme applied to the same input. Only the selected theme changes: ```{vl-chart} /_examples/theme-demo.vl.json :themes: /_examples/themes.json :theme: brand :alt: The stacked bar chart with the brand theme's blue and green palette ``` See {doc}`../advanced/configuration` to set a default theme for every conversion, and {doc}`../advanced/conversion-overrides` to pass a raw `config` object instead of a named theme.