I need color themes for my website. So what I intended on doing was making a class in CSS,
#box {
width: 500px;
height: 300px;
}
.color1 {
background-color: rgb(105, 105, 105);
}
Applying it to my HTML div element,
<div class="color1" id="box">
<button id="darkModeButton">Dark Mode</button>
</div>
<div class="color1">
</div>
<div class="color1">
</div>
And then when the button is clicked change the color of all the elements with the class color1,
var darkModeButton = document.querySelector("#darkModeButton");
darkModeButton.onclick = function() {
//something like this:
color1.backgroundColor = "rgb(55, 55, 55)";
//but obiviously this doesn't work so how can i fix this
}