update color theme in demo.
save current theme preference to localstorage. update to v0.10.0.
This commit is contained in:
@@ -8,6 +8,11 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
toggle.addEventListener("click", () => {
|
||||
document.body.classList.toggle("invertedTheme");
|
||||
|
||||
localStorage.setItem(
|
||||
"useInvertedTheme",
|
||||
document.body.classList.contains("invertedTheme") ? "true" : "",
|
||||
);
|
||||
});
|
||||
|
||||
toggle.innerHTML = `
|
||||
@@ -28,6 +33,9 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
`.trim();
|
||||
|
||||
document.body.appendChild(toggle);
|
||||
|
||||
if (!!localStorage.getItem("useInvertedTheme"))
|
||||
document.body.classList.add("invertedTheme");
|
||||
});
|
||||
|
||||
// @license-end
|
||||
|
||||
Reference in New Issue
Block a user