aboutsummaryrefslogtreecommitdiff
path: root/static/js/theme_light.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/theme_light.js')
-rw-r--r--static/js/theme_light.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/static/js/theme_light.js b/static/js/theme_light.js
new file mode 100644
index 0000000..cea48ac
--- /dev/null
+++ b/static/js/theme_light.js
@@ -0,0 +1,4 @@
+// enforce local storage setting but also fallback to user-agent preferences
+if (localStorage.getItem('theme') === 'switch' || (!localStorage.getItem('theme') && !window.matchMedia("(prefers-color-scheme: light)").matches)) {
+ document.documentElement.classList.add('switch');
+}