Make default colour schemes for the web UI configurable on the server side #102

This commit is contained in:
Ian Renton
2026-01-30 21:31:13 +00:00
parent 221fade44b
commit 2be1c5b3d3
14 changed files with 53 additions and 28 deletions

View File

@@ -144,8 +144,11 @@ function columnsUpdated() {
// Function to set the colour scheme based on the state of the UI select box
function setColorSchemeFromUI() {
setColorScheme($("#color-scheme option:selected").val());
saveSettings();
let theme = $("#color-scheme option:selected").val();
if (theme != "") {
setColorScheme(theme);
saveSettings();
}
}
// Function to set the color scheme. Supported values: "dark", "light", "auto"
@@ -164,7 +167,8 @@ function setColorScheme(mode) {
// Startup function to determine whether to use light or dark mode, or leave as auto
function usePreferredTheme() {
// 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 stay with nothing selected, so that the server sets it to whatever the
// server's default is when the options call is retrieved.
let val = localStorage.getItem("#color-scheme:value");
if (val != null) {
setColorScheme(JSON.parse(val));