Fix theme color (#31366)

pull/31453/head
quthla 2020-02-03 23:09:25 +01:00 committed by GitHub
parent f5b790054a
commit 3f9dbe6845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -342,10 +342,12 @@ def _async_setup_themes(hass, themes):
"""Update theme_color in manifest."""
name = hass.data[DATA_DEFAULT_THEME]
themes = hass.data[DATA_THEMES]
if name != DEFAULT_THEME and PRIMARY_COLOR in themes[name]:
MANIFEST_JSON["theme_color"] = themes[name][PRIMARY_COLOR]
else:
MANIFEST_JSON["theme_color"] = DEFAULT_THEME_COLOR
MANIFEST_JSON["theme_color"] = DEFAULT_THEME_COLOR
if name != DEFAULT_THEME:
MANIFEST_JSON["theme_color"] = themes[name].get(
"app-header-background-color",
themes[name].get(PRIMARY_COLOR, DEFAULT_THEME_COLOR),
)
hass.bus.async_fire(
EVENT_THEMES_UPDATED, {"themes": themes, "default_theme": name}
)