Fix theme color (#31366)

This commit is contained in:
quthla 2020-02-03 23:09:25 +01:00 committed by Paulus Schoutsen
parent 2f2146c989
commit 1008ab20ba

View File

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