mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 09:14:30 +00:00
Make default colour schemes for the web UI configurable on the server side #102
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user