fix darkmode toggle

This commit is contained in:
FreddleSpl0it committed 2022-12-16 09:40:20 +01:00
1 parent 5160eff294
commit f1bb23ba2a
3 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -11,8 +11,8 @@
<link rel="stylesheet" href="{{ css_path }}">
<script>
// check if darkmode is preferred by OS or set by localStorage
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ||
JSON.parse(localStorage.getItem("darkmode")) === true) {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches && localStorage.getItem("theme") !== "light" ||
localStorage.getItem("theme") === "dark") {
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.id = 'dark-mode-theme';