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;
align-items: center;
justify-content: center;
content: "";
content: "";
border-style: solid;
}
@ -50,7 +50,7 @@ input:checked + label:after{
input:checked + label::after{
content: "";
content: "";
}
.footer-nav-item{

View File

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