-2
<div onclick="theme()" class="theme">
<img id ="theme"src="elements/dark.svg"/>
</div>```
______________________________________________
let bodydark = document.getElementById('body');
function theme() {
document.getElementById("theme").src="elements/light.png";
change_theme();
}
function change_theme() {
bodydark.style.background = 'var(--overlay)';
let div_wrapper = document.getElementById("q1").style.backgroundColor = '#091b38';
let div_wrapper1 = document.getElementById("q2").style.backgroundColor = '#091b38';
let div_wrapper2 = document.getElementById("q3").style.backgroundColor = '#091b38';
}
Basically this code when clicking on div a function Theme() changes the src of the div and changes the theme to dark, I would like it to be possible to click again on the div back to default, similar to the change theme of google Chrome. Please help me out! I don’t know if the right word would be to deactivate the existing function, but I tried to put 2 functions inside the div, one to change the theme and the other to give a Reloader on the page, but one kind of clashes with the other and runs both at the same time and the page gets dark and recharges so on!
Yeah, good idea, thanks!
– romao