Create theme file
themes_create_themeCreate a new Lovelace theme file in Home Assistant, writing themes/.yaml and reloading themes. Fails if the theme exists unless overwrite is true.
Instructions
Create a new Lovelace theme file.
Writes themes/<name>.yaml as {<name>: variables}. The file is only
loaded by the frontend if configuration.yaml has frontend: themes: !include_dir_merge_named themes. Fails instead of overwriting unless
overwrite=True.
Use when: adding a brand-new theme.
Not for: changing an existing theme in place — use
themes_update_theme.
Returns: dict with success, path, and reloaded (present when
reload=True).
Errors: {"success": false, "error": "Theme '<name>' already exists. Pass overwrite=True to replace."} when the file exists and
overwrite is false; {"success": false, "error": "invalid_theme_name", "detail": ...} when name contains '/' or a
backslash, starts with '.', or is blank.
Limits: name must not contain '/' or a backslash, start with '.', or
be blank.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Theme name, becomes the filename themes/<name>.yaml without the extension. | |
| reload | No | If true, calls frontend.reload_themes after writing the file; defaults to true. | |
| overwrite | No | If true, replaces an existing theme file instead of failing; defaults to false. | |
| variables | Yes | Inner theme variable map to write, e.g. {'primary-color': '#03a9f4'} or a 'modes' block with 'light'/'dark' keys; not wrapped in the theme name. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||