dark by default

This commit is contained in:
Zoe 2022-04-13 12:43:01 +02:00
parent 72e5576a15
commit 84ce2ba287
2 changed files with 9 additions and 9 deletions

View file

@ -39,7 +39,7 @@ input[type="checkbox"]{
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
content: ""; content: "";
border-style: solid; border-style: solid;
} }
@ -50,7 +50,7 @@ input:checked + label:after{
input:checked + label::after{ input:checked + label::after{
content: ""; content: "";
} }
.footer-nav-item{ .footer-nav-item{

View file

@ -1,20 +1,20 @@
const checkbox = document.getElementById("darkmode-toggle"); const checkbox = document.getElementById("darkmode-toggle");
const colorswitchers = document.getElementsByClassName("colorswitch"); const colorswitchers = document.getElementsByClassName("colorswitch");
if (localStorage.getItem("dark")) { if (localStorage.getItem("light")) {
switchToDark();
} else {
switchToLight(); switchToLight();
} else {
switchToDark();
} }
checkbox.checked = localStorage.getItem("dark"); checkbox.checked = localStorage.getItem("dark");
checkbox.addEventListener("change", function () { checkbox.addEventListener("change", function () {
localStorage.setItem("dark", this.checked); localStorage.setItem("light", this.checked);
if (this.checked) { if (this.checked) {
switchToDark();
} else {
localStorage.removeItem("dark");
switchToLight(); switchToLight();
} else {
localStorage.removeItem("light");
switchToDark();
} }
}); });