mirror of
https://git.kittycat.homes/zoe/hugo-battheme.git
synced 2024-08-15 03:25:18 +00:00
dark by default
This commit is contained in:
parent
72e5576a15
commit
84ce2ba287
2 changed files with 9 additions and 9 deletions
|
@ -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{
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue