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:
parent
c7187ebcc4
commit
fa3ce87d57
@ -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"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user