From 3af6d9131f6dfc138856d718ec96626344095ec8 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 22 May 2023 23:24:44 -0700 Subject: Optimizations and Fixes --- static/js/theme.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 static/js/theme.js (limited to 'static/js/theme.js') diff --git a/static/js/theme.js b/static/js/theme.js new file mode 100644 index 0000000..5f6f0f6 --- /dev/null +++ b/static/js/theme.js @@ -0,0 +1,4 @@ +// enforce local storage setting but also fallback to user-agent preferences +if (localStorage.getItem('theme') === 'light' || (!localStorage.getItem('theme') && !window.matchMedia("(prefers-color-scheme: dark)").matches)) { + document.documentElement.classList.add('light'); +} -- cgit v1.3.1