Change Label Card Text Color

Ok I figured out what I did wrong.

First, the parameter needs to be set in the config slot of the oh-grid-col component and not of the oh-label-card itself.
And second-

That is correct! thanks.

To illustrate see below the code for a label card that changes from dark to light according to some other dimmer item.

So, the wrong way (which I tried at first):

              - component: oh-grid-col
                config: {}
                slots:
                  default:
                    - component: oh-label-card
                      config:
                        title: Testing Theme Change
                        label: Test
                        icon: oh:lightbulb
                        background: '=(items.TestDimmer.state < "50") ? "white" : "black"'
                        themeDark: '=(items.TestDimmer.state < "50") ? "false" : "true"'

And the right way:

              - component: oh-grid-col
                config:
                  themeDark: '=(items.TestDimmer.state < "50") ? false : true'
                slots:
                  default:
                    - component: oh-label-card
                      config:
                        title: Testing Theme Change
                        label: Test
                        icon: oh:lightbulb
                        background: '=(items.TestDimmer.state < "50") ? "white" : "black"'

I guess it’s still not a way to set any color to the label but it’s solves my problem and I hope OP’s as well. (@gatekeeper6838 )
Thanks everyone!!

1 Like