I think my solution provides what you need.
Within the if/else statement you can add/remove pseudo class names from other html elements, thus affecting the visual appearance.
For example, I have created
this jsfiddle to show you what I mean.
In that example I have created two indicator lamps. Initially they each have a class of "lamp", specified using hard-coded html syntax. When the slider switch goes into the "on" position I have add a pseudo-class called "green" to one of the indicator elements, and a class called "red" to the other one.
When the switch is moved into the off position, my code removes the pseudo-classes from both indicator lamps.
I have defined some CSS styling for each lamp, matching the "green" and "red" pseudo-classes,
I hope my code helps you. When you know what you wish to achieve, post back on here and someone will help you.
Best wishes,
Alan