diff options
| author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-27 20:08:58 -0600 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-27 20:08:58 -0600 |
| commit | b2fa4fe9454cbc9c9c0e265e3e6065eaa8726e2f (patch) | |
| tree | 4c7fcf0b7f90117dab8f8d110d42b261ed7440fc /static/js/util/setThemeBeforeRender.js | |
| parent | b6e8e041096a921accd439db00c9171c0f68d91b (diff) | |
| download | hatecomputers.club-b2fa4fe9454cbc9c9c0e265e3e6065eaa8726e2f.tar.gz hatecomputers.club-b2fa4fe9454cbc9c9c0e265e3e6065eaa8726e2f.zip | |
moar blinkies
Diffstat (limited to 'static/js/util/setThemeBeforeRender.js')
| -rw-r--r-- | static/js/util/setThemeBeforeRender.js | 7 |
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"), +); |
