$w.onReady(function () { });
export function switch1_change(event) {
if($w('#switch1').checked===true) {
$w('#box1').style.backgroundColor = "rgb(255,255,255)";
}
else {
$w('#box1').style.backgroundColor = "rgb(0,0,0)";
}
}
Here an example…
https://www.media-junkie.com/color-switch
Yes it is just a box and not the whole backgroundcolor of the website.
Could not find the right command for the whole site.
EDIT: Here a better solution…
$w.onReady(function () {
$w('#switch1').onChange(()=>{
if($w('#switch1').checked===true) {$w('#box1').style.backgroundColor = "rgb(255,255,255)";}
else {$w('#box1').style.backgroundColor = "rgb(0,0,0)";}
});
});