transition only on change not load

This commit is contained in:
Anthony Stirling 2024-05-18 12:48:01 +01:00
parent f0dd48b3b1
commit 389323c190
2 changed files with 7 additions and 1 deletions

View file

@ -4,9 +4,13 @@ select,
textarea {
background-color: var(--md-sys-color-surface);
color: var(--md-sys-color-on-surface);
}
.transition-theme {
transition: background 0.5s ease, color 0.5s ease, border 0.5s ease;
}
/*.global-buttons-container input:disabled::-webkit-input-placeholder { !* WebKit browsers *!*/
/* color: #98A0AB;*/
/*}*/

View file

@ -55,7 +55,7 @@ function setMode(mode) {
});
} else if (mode === "rainbow") {
if (elements && elements.darkModeIcon) {
elements.darkModeIcon.src = "rainbow.svg";
elements.darkModeIcon.textContent = "looks";
}
}
}
@ -69,6 +69,8 @@ function toggleDarkMode() {
}
lastToggleTime = currentTime;
document.body.classList.add("transition-theme");
if (toggleCount >= 18) {
localStorage.setItem("dark-mode", "rainbow");
setMode("rainbow");