1
0
mirror of https://github.com/Damillora/Yuika synced 2024-12-25 13:43:46 +00:00

fix(theme): fix persistence of dark mode

This commit is contained in:
Damillora 2021-04-14 22:26:55 +07:00
parent c7187ebcc4
commit fa3ce87d57

View File

@ -1,5 +1,5 @@
function setDarkMode() {
if (!window.localStorage.getItem('theme') && window.document.body.getAttribute("data-theme")){
if (window.document.body.getAttribute("data-theme")){
window.localStorage.setItem('theme', window.document.body.getAttribute("data-theme"));
}
if (window.document.body.getAttribute("data-theme") == "dark") {
@ -10,6 +10,7 @@ function setDarkMode() {
$("#darkMode p").text("Dark Mode");
}
}
if (window.localStorage.getItem('theme')) {
window.document.body.setAttribute("data-theme", window.localStorage.getItem("theme"));
}