fix theme

This commit is contained in:
joBr99
2023-01-29 21:10:38 +01:00
parent 516a2dc000
commit 8dfe5e87d4
2 changed files with 6 additions and 14 deletions

View File

@@ -139,6 +139,9 @@ class LuiPagesGen(object):
item_str += self.generate_entities_item(item, "cardEntities")
self._send_mqtt_msg(f"weatherUpdate{item_str}")
# send color if configured in screensaver
if theme is not None:
self._send_mqtt_msg(get_screensaver_color_output(theme=theme))
def update_status_icons(self):
status_res = ""

View File

@@ -30,23 +30,12 @@ default_screensaver_color_mapping = {
def get_screensaver_color_output(theme, state=None):
color_output = "color"
for key in default_screensaver_color_mapping:
color_output += f"~{map_color(key=key, theme=theme, state=state)}"
color_output += f"~{map_color(key=key, theme=theme)}"
return color_output
def map_color(key, theme, state=None):
def map_color(key, theme):
config_color = default_screensaver_color_mapping[key]
# Use theme color if set
if key in theme:
config_color = rgb_dec565(theme[key])
# Use Autocolouring for weather
elif state is not None:
if key in ["tMainIcon", "tF1Icon", "tF2Icon", "tF3Icon", "tF4Icon"]:
config_color = map_weather_icon_color(key=key, theme=theme, state=state)
return config_color
def map_weather_icon_color(key, theme, state):
if key in state and state[key] in theme:
config_color = rgb_dec565(theme[state[key]])
else:
config_color = "65535"
return config_color
return config_color