I'm currently trying to do it by changing my :root variables for the color scheme of the page with a function changeBackgrondColor() and assigning to my fontAwesome moon "button". However, when i click at the moon, the page changes all of the colors for a sec and then comeback to the original form.
var r = document.querySelector(':root');
var rootStyles = getComputedStyle(r);
function changeBackgroundColor(){
r.style.setProperty('--clr-1', 'blue');
r.style.setProperty('--clr-2', 'blue');
r.style.setProperty('--clr-3', 'blue');
r.style.setProperty('--clr-4', 'blue');
}