From cd71559564732e4f2b4752560ff1b6de6f737a79 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Wed, 19 Jul 2023 13:32:33 -0700 Subject: nojs configurable default switcher theme --- static/js/theme_light.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 static/js/theme_light.js (limited to 'static/js/theme_light.js') 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'); +} -- cgit v1.3.1