summaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js')
-rw-r--r--static/js/util/setThemeBeforeRender.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/static/js/util/setThemeBeforeRender.js b/static/js/util/setThemeBeforeRender.js
index b8f299a..b025cce 100644
--- a/static/js/util/setThemeBeforeRender.js
+++ b/static/js/util/setThemeBeforeRender.js
@@ -1,8 +1,11 @@
const preferredMode = window.matchMedia("(prefers-color-scheme: dark)").matches
? "DARK"
: "LIGHT";
-localStorage.setItem("theme", localStorage.getItem("theme") || preferredMode);
// sets theme before rendering & jquery loaded to prevent flashing of uninitialized theme
// (ugly white background)
-document.documentElement.setAttribute("data-theme", preferredMode);
+localStorage.setItem("theme", localStorage.getItem("theme") || preferredMode);
+document.documentElement.setAttribute(
+ "data-theme",
+ localStorage.getItem("theme"),
+);