Add branded web loading screen
This commit is contained in:
@@ -13,6 +13,7 @@ var _is_dark := true
|
||||
func _enter_tree() -> void:
|
||||
_is_dark = _load_preference()
|
||||
Style.set_dark_mode(_is_dark)
|
||||
_sync_web_preference()
|
||||
|
||||
|
||||
func is_dark_mode() -> bool:
|
||||
@@ -25,6 +26,7 @@ func set_dark_mode(value: bool) -> void:
|
||||
_is_dark = value
|
||||
Style.set_dark_mode(_is_dark)
|
||||
_save_preference()
|
||||
_sync_web_preference()
|
||||
theme_changed.emit(_is_dark)
|
||||
|
||||
|
||||
@@ -59,3 +61,14 @@ func _save_preference() -> void:
|
||||
config.set_value(SETTINGS_SECTION, SETTINGS_KEY, "dark" if _is_dark else "light")
|
||||
if config.save(SETTINGS_PATH) != OK:
|
||||
push_warning("Unable to save color scheme preference.")
|
||||
|
||||
|
||||
func _sync_web_preference() -> void:
|
||||
if not OS.has_feature("web"):
|
||||
return
|
||||
JavaScriptBridge.eval(
|
||||
"try { window.localStorage.setItem('medmind-color-scheme', %s); } catch (error) { console.warn('Theme preference storage is unavailable.', error); }" % JSON.stringify(
|
||||
"dark" if _is_dark else "light"
|
||||
),
|
||||
true
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user