# Can I dynamically change the background color of a switch?

**URL:** https://discourse.nodered.org/t/can-i-dynamically-change-the-background-color-of-a-switch/9886
**Category:** Dashboard
**Created:** [8 April 2019 03:07 UTC](https://discourse.nodered.org/t/can-i-dynamically-change-the-background-color-of-a-switch/9886 "2019-04-08T03:07:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)
#### Post date: [8 April 2019 03:07 UTC](https://discourse.nodered.org/t/can-i-dynamically-change-the-background-color-of-a-switch/9886/1 "2019-04-08T03:07:05Z")

</div>

Is there a way to change a switch or button background color from inside the flow? For example, if I click on a button with a green background, I want to turn it red.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [8 April 2019 04:05 UTC](https://discourse.nodered.org/t/can-i-dynamically-change-the-background-color-of-a-switch/9886/2 "2019-04-08T04:05:25Z")

</div>

Are you referring to `node-red-dashboard` ?  
Yes there is a way. You can use the template node.

You can read some hints here

> [@Output two attributes in the template](https://discourse.nodered.org/t/output-two-attributes-in-the-template/5983/11):
>
> That do not work, but thanks for your help grinning

---

<div class="post-metadata">

### Author: ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)
#### Post date: [8 April 2019 22:03 UTC](https://discourse.nodered.org/t/can-i-dynamically-change-the-background-color-of-a-switch/9886/3 "2019-04-08T22:03:41Z")

</div>

Thanks for the tip- I learned something today. I did not know that I could make buttons using the Template Node. I like that md-button class="vibrate filled touched bigfont rounded" vibrates on the phone since that's where this flow will be used.

I haven't seen how to _change_ the button background color. Once a button is pressed, I want to permanently change the background color to indicate to the user that this button has already been pressed.
