switchery icon indicating copy to clipboard operation
switchery copied to clipboard

Add `is-selected` class when switch is ON

Open vfonic opened this issue 8 years ago • 2 comments

Hi,

Great work on switchery! Thanks!

I'm using SASS for my CSS and along with it, I've got some branding colors set through SASS variables. I'd like to be able to set the switch class when it's ON so that I can customize that particular class in my SASS like this:

.switchery.is-selected {
  background-color: $brand-main;
}

Is this possible?

Currently, this is how I have it set:

new Switchery(this, { color: '#7ee1c4' });

Notice how now I have the main color specified in two places: once for $brand-main in SASS and once as a 'magic value' in the middle of my javascript code.

Thanks! Viktor

vfonic avatar Sep 29 '15 12:09 vfonic