var container = document.querySelector(".container")
var light2 = document.getElementById("light");
var dark2 = document.getElementById("dark");
light2.addEventListener('click', lightMode);
function lightMode(){
container.style.backgroundColor = "white";
container.style.color = "black";
}
dark2.addEventListener('click', darkMode);
function darkMode() {
container.style.transition = "background-color 1s ease-in, color 1s ease-in";
container.style.backgroundColor = "black";
container.style.color = "white";
}
This code belongs to me, can anyone suggest how to add a transition effect when switching to dark mode?
I am looking for the transition to be applied smoothly when transitioning from dark mode to light mode, not an instant change. The transition should have a duration of 1 second with an easing effect.