summaryrefslogtreecommitdiff
path: root/site/themes/sine/static/js/switch-theme.js
diff options
context:
space:
mode:
authortriethyl <triethylammonium@pm.me>2026-02-16 00:38:52 -0500
committertriethyl <triethylammonium@pm.me>2026-02-16 00:38:52 -0500
commit5c38768c2f9c8b2c9830db62bd5f8103e25b5d9b (patch)
treeb44482828927f9998772ae47bd388821e3fa3271 /site/themes/sine/static/js/switch-theme.js
parent7ab959b38b096cecb62f5878bb29197d62d4394d (diff)
fix bug where invalid theme broke sitemain
Diffstat (limited to 'site/themes/sine/static/js/switch-theme.js')
-rw-r--r--site/themes/sine/static/js/switch-theme.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/site/themes/sine/static/js/switch-theme.js b/site/themes/sine/static/js/switch-theme.js
index 8baaee5..433ace1 100644
--- a/site/themes/sine/static/js/switch-theme.js
+++ b/site/themes/sine/static/js/switch-theme.js
@@ -17,7 +17,7 @@ const defaultLightTheme = "melatonin-light";
// checks whether there is already a theme and if not, sets it to the user's default theme.
function calculateTheme({ localStorageTheme, systemSettingDark }) {
- if (localStorageTheme !== null) {
+ if (localStorageTheme !== null && themeOrder.includes(localStorageTheme)) {
return localStorageTheme;
}
@@ -58,7 +58,6 @@ const systemSettingDark = window.matchMedia("(prefers-color-scheme: dark)");
// 2. Work out the current site settings
let currentTheme = calculateTheme({ localStorageTheme, systemSettingDark });
-console.log(currentTheme)
// 3. Update the theme setting and button text accoridng to current settings
updateButton( button, currentTheme);
@@ -72,7 +71,8 @@ button.addEventListener("click", (event) => {
updateButton( button, newTheme);
applyTheme( newTheme );
+ // console.log(themeOrder)
+
currentTheme = newTheme;
- console.log(currentTheme)
});