# Problem changing button colors

**URL:** <https://discourse.nodered.org/t/problem-changing-button-colors/98474>\
**Category:** General\
**Tags:** node-red-dashboard, function-node\
**Created:** [3 August 2025 03:23 UTC](https://discourse.nodered.org/t/problem-changing-button-colors/98474 "2025-08-03T03:23:38Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [4 August 2025 12:05 UTC](https://discourse.nodered.org/t/problem-changing-button-colors/98474/21 "2025-08-04T12:05:05Z")

</div>

I was able to copy the flow after passing through gemini.google and have shown the configuration done by him for background color.  
i see that the config of the button node is like below

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/1/71ff4aeefe06ffe1394c5679a3695e6859798210.png)

msg.bcolor instead of {{bgcolor}}

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [4 August 2025 12:44 UTC](https://discourse.nodered.org/t/problem-changing-button-colors/98474/23 "2025-08-04T12:44:29Z")

</div>

Not sure which Dashboard you are using. This example is for **DB1**

 ![Monday_button_back](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/1/21b9f37bc80d7af2b3c7d28b870f7db7915c2748.png)  
Settings in the Button node...  
 ![Monday_button_setting](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/11f38741913381c0973b76febed6112283470e1c.png)  
Configure the Inject nodes like this...  
 ![monday_inject](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/124c6bc61bec01e2f06913949b4ea2830d14e6b9.png)  
You can use any name for the message attribute or property` (e.g. msg.fred)` as long as they agree in the Button node and Inject node.

Here's the NR flow for you to try... (copy and import it into your NR flow)

```auto
[{"id":"3b6da4c9ba1e667a","type":"ui_button","z":"b62a08c8f27a646f","name":"","group":"098b99c4fe660992","order":6,"width":0,"height":0,"passthru":false,"label":"Turn pump OFF","tooltip":"","color":"","bgcolor":"{{background}}","className":"","icon":"","payload":"","payloadType":"str","topic":"","topicType":"str","x":940,"y":640,"wires":[[]]},{"id":"ec0bccd81a23a5dd","type":"inject","z":"b62a08c8f27a646f","name":"Set button background to RED","props":[{"p":"background","v":"red","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":700,"y":620,"wires":[["3b6da4c9ba1e667a"]]},{"id":"7c97ee44908c7817","type":"inject","z":"b62a08c8f27a646f","name":"Set button background to RED","props":[{"p":"background","v":"green","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":700,"y":660,"wires":[["3b6da4c9ba1e667a"]]},{"id":"098b99c4fe660992","type":"ui_group","name":"Manual Controls","tab":"71dfb528d156e895","order":6,"disp":true,"width":"3","collapse":false,"className":""},{"id":"71dfb528d156e895","type":"ui_tab","name":"Herb and Pebble Garden","icon":"dashboard","order":24,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![kburns2](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@kburns2](https://discourse.nodered.org/u/kburns2)\
**Post date:** [4 August 2025 13:15 UTC](https://discourse.nodered.org/t/problem-changing-button-colors/98474/24 "2025-08-04T13:15:02Z")

</div>

Interesting as Gemini gave me the code to put in there. I will try that and let you know.

However, my problem is still that I have to press the buttons twice to get a response. Any thoughts?

---

<div class="post-metadata">

**Author:** ![smanjunath211](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smanjunath211/32/95742_2.png) [@smanjunath211](https://discourse.nodered.org/u/smanjunath211)\
**Post date:** [4 August 2025 14:23 UTC](https://discourse.nodered.org/t/problem-changing-button-colors/98474/25 "2025-08-04T14:23:58Z")

</div>

Did you try my code??

---

<div class="post-metadata">

**Author:** ![kburns2](https://avatars.discourse-cdn.com/v4/letter/k/77aa72/32.png) [@kburns2](https://discourse.nodered.org/u/kburns2)\
**Post date:** [4 August 2025 15:21 UTC](https://discourse.nodered.org/t/problem-changing-button-colors/98474/26 "2025-08-04T15:21:20Z")

</div>

Not yet. I am at work and my Node Red installation is at home.

[Previous page](https://discourse.nodered.org/t/problem-changing-button-colors/98474.md?page=1)
