# Changing switch foreground color dynamicly

**URL:** <https://discourse.nodered.org/t/changing-switch-foreground-color-dynamicly/92257>\
**Category:** Dashboard\
**Created:** [9 October 2024 09:14 UTC](https://discourse.nodered.org/t/changing-switch-foreground-color-dynamicly/92257 "2024-10-09T09:14:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![juntiedt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juntiedt/32/58357_2.png) [@juntiedt](https://discourse.nodered.org/u/juntiedt)\
**Post date:** [9 October 2024 09:14 UTC](https://discourse.nodered.org/t/changing-switch-foreground-color-dynamicly/92257/1 "2024-10-09T09:14:31Z")

</div>

I have 4 buttons which should change the foreground color when pressed. I have this working on DB 1. The active button is white and the rest is black.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/84d083cbd5118836e8e3092a7c9a27ba26388172.png)

how does this work on DB 2?

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [9 October 2024 09:18 UTC](https://discourse.nodered.org/t/changing-switch-foreground-color-dynamicly/92257/2 "2024-10-09T09:18:58Z")

</div>

I posted an example flow at [https://discourse.nodered.org/t/css-styling-ui-button-widgets-on-dashboard-2/90969](https://discourse.nodered.org/t/css-styling-ui-button-widgets-on-dashboard-2/90969) showing some examples of styling ui-buttons on dashboard 2, including changing the button label colour (see the Bilge Pump button)

ps your picture shows a switch and 4 buttons. I assume, despite the title, that you are referring to the buttons?

---

<div class="post-metadata">

**Author:** ![juntiedt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juntiedt/32/58357_2.png) [@juntiedt](https://discourse.nodered.org/u/juntiedt)\
**Post date:** [9 October 2024 09:25 UTC](https://discourse.nodered.org/t/changing-switch-foreground-color-dynamicly/92257/3 "2024-10-09T09:25:10Z")

</div>

That was a fast and helpful response.  
This is exactly what I need!  
Thank you very much 👍 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 October 2024 09:25 UTC](https://discourse.nodered.org/t/changing-switch-foreground-color-dynamicly/92257/4 "2024-10-23T09:25:49Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
