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 { textarea {
background-color: var(--md-sys-color-surface); background-color: var(--md-sys-color-surface);
color: var(--md-sys-color-on-surface); color: var(--md-sys-color-on-surface);
}
.transition-theme {
transition: background 0.5s ease, color 0.5s ease, border 0.5s ease; transition: background 0.5s ease, color 0.5s ease, border 0.5s ease;
} }
/*.global-buttons-container input:disabled::-webkit-input-placeholder { !* WebKit browsers *!*/ /*.global-buttons-container input:disabled::-webkit-input-placeholder { !* WebKit browsers *!*/
/* color: #98A0AB;*/ /* color: #98A0AB;*/
/*}*/ /*}*/

View file

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