diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2022-06-03 12:13:47 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2022-06-03 12:13:47 -0500 |
| commit | 0a768b251e29611f6877fb81d34fbe10ea95c83a (patch) | |
| tree | 6c73111f59f9b9547ce4cc976f0b6dfd6887584c /public/index.html | |
| parent | 9053fa0c77b647a61ff18cfed9e6a203b73bdaae (diff) | |
Bugfix browser prefers dark mode, but loads page in lightmode
Diffstat (limited to 'public/index.html')
| -rw-r--r-- | public/index.html | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/public/index.html b/public/index.html index 1781510..adf7737 100644 --- a/public/index.html +++ b/public/index.html @@ -19,10 +19,13 @@ <!-- Set initial theme the theme --> <script> - if ("theme" in localStorage) + if ("theme" in localStorage) { document.documentElement.setAttribute('data-theme', localStorage.theme) - else if (window.matchMedia('(prefers-color-scheme: dark)').matches) + } + else if (window.matchMedia('(prefers-color-scheme: dark)').matches) { localStorage.theme = 'dark' + document.documentElement.setAttribute('data-theme', 'dark') + } else localStorage.theme = 'light' </script> |
