Skip to content

Commit 50eb5d1

Browse files
Properly handle misconfigurations in theme color
1 parent 9fd1430 commit 50eb5d1

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

internal_filesystem/main.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@
1919
primary_color = lv.theme_get_color_primary(None)
2020
color_string = prefs.get_string("theme_primary_color")
2121
if color_string:
22-
color_string = color_string.replace("0x", "").replace("#", "").strip().lower()
23-
color_int = int(color_string, 16)
24-
print(f"Setting primary color: {color_int}")
25-
primary_color = lv.color_hex(color_int)
22+
try:
23+
color_string = color_string.replace("0x", "").replace("#", "").strip().lower()
24+
color_int = int(color_string, 16)
25+
print(f"Setting primary color: {color_int}")
26+
primary_color = lv.color_hex(color_int)
27+
except Exception as e:
28+
print(f"Converting color setting '{color_string}' to lv_color_hex() got exception: {e}")
2629
theme = lv.theme_default_init(display._disp_drv, primary_color, lv.color_hex(0xFBDC05), theme_dark_bool, lv.font_montserrat_12)
2730

2831
#display.set_theme(theme)

0 commit comments

Comments
 (0)