Web UI options faff

This commit is contained in:
Ian Renton
2026-01-30 20:56:18 +00:00
parent 221fade44b
commit 6ed0eed10b
17 changed files with 64 additions and 45 deletions

View File

@@ -163,11 +163,16 @@ function setColorScheme(mode) {
// Startup function to determine whether to use light or dark mode, or leave as auto
function usePreferredTheme() {
// Set the value of the select box to the server's default
$("#color-scheme").val(web_ui_options["default-color-scheme"]);
// Work out if we have ever explicitly saved the value of our select box. If so, we set our colour scheme now based
// on that. If not, we let the select retain its default value of "auto".
// on that. If not, we let the select retain its default value from Spothole config and apply that.
let val = localStorage.getItem("#color-scheme:value");
if (val != null) {
setColorScheme(JSON.parse(val));
} else {
setColorSchemeFromUI();
}
}