Switch buttons individual style/images

i’m trying to have different on/off background images for every button in a switch.
i was able to do a global image for on/off but cannot find a way to do it individually.
are they accessible individually?

switch

1 Like

You can use the css selector :nth-child():

value:nth-child(2) {
  --color-fill:red
}
2 Likes

This is great - I can do the colour changes but can I use this to put a base64 image on each child? I can’t seem to be able to get this to work.

You must use the appropriate css property to change the background image:

value:nth-child(2) {
  background-image: url(data:image/gif;base64,/* ... */)
}

Brilliant, thanks!

Good evening !
Can't this work with :

value:nth-child(2) {
  --color-text:red
}

??

--color-text is not used at this level in the widget''s css, but you can write

value:nth-child(2) {
  color: red
}
1 Like