Custom icon color in dashboard switch widget

#1

I am using the custom icon option in a dashboard switch node (ui_switch), and would like to be able to set the On/Off Colour options in a way that will work well with more than one dashboard theme, in particular the Dark theme as well as the default Light theme. I have tried an intermediate, gray color, but this makes the icon difficult to see in either theme. Can anyone think of a way to tie this color selection to the overall theme of the dashboard, or am I stuck with a color that works well in one theme and not others?

0 Likes

How to retrieve "Site Sizes" from my custom node source code
#2

You can send ui_control object to the ui_switch node.

msg.ui_control = {onicon:"fa-fire",oncolor:"orange",officon:"fa-fire",offcolor:"yellow"}

The colors unfortunately I guess you can't get from theme directly. Probably best way is to store set of color values in flow or globally if needed more than one place and then figure out some logic to choose between sets to get chosen colors into incoming message for ui_switch node

0 Likes

#3

Thanks, @hotNipi. That's a big step in the right direction. It also reminds me how much documentation I've read, never used, and promptly forgotten... :slightly_smiling_face:

1 Like