From 389323c190cd17037f27245526d7bb23704c4341 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Sat, 18 May 2024 12:48:01 +0100 Subject: [PATCH] transition only on change not load --- src/main/resources/static/css/theme/componentes.css | 4 ++++ src/main/resources/static/js/darkmode.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/resources/static/css/theme/componentes.css b/src/main/resources/static/css/theme/componentes.css index 9ab84b03..d588d686 100644 --- a/src/main/resources/static/css/theme/componentes.css +++ b/src/main/resources/static/css/theme/componentes.css @@ -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;*/ /*}*/ diff --git a/src/main/resources/static/js/darkmode.js b/src/main/resources/static/js/darkmode.js index 3c179d5e..08c0c380 100644 --- a/src/main/resources/static/js/darkmode.js +++ b/src/main/resources/static/js/darkmode.js @@ -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");