mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-01-30 18:14:13 +01:00
fix theme
This commit is contained in:
@@ -139,6 +139,9 @@ class LuiPagesGen(object):
|
|||||||
item_str += self.generate_entities_item(item, "cardEntities")
|
item_str += self.generate_entities_item(item, "cardEntities")
|
||||||
|
|
||||||
self._send_mqtt_msg(f"weatherUpdate{item_str}")
|
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):
|
def update_status_icons(self):
|
||||||
status_res = ""
|
status_res = ""
|
||||||
|
|||||||
@@ -30,23 +30,12 @@ default_screensaver_color_mapping = {
|
|||||||
def get_screensaver_color_output(theme, state=None):
|
def get_screensaver_color_output(theme, state=None):
|
||||||
color_output = "color"
|
color_output = "color"
|
||||||
for key in default_screensaver_color_mapping:
|
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
|
return color_output
|
||||||
|
|
||||||
def map_color(key, theme, state=None):
|
def map_color(key, theme):
|
||||||
config_color = default_screensaver_color_mapping[key]
|
config_color = default_screensaver_color_mapping[key]
|
||||||
# Use theme color if set
|
# Use theme color if set
|
||||||
if key in theme:
|
if key in theme:
|
||||||
config_color = rgb_dec565(theme[key])
|
config_color = rgb_dec565(theme[key])
|
||||||
# Use Autocolouring for weather
|
return config_color
|
||||||
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
|
|
||||||
Reference in New Issue
Block a user