Changing item/text colors in buttons

I’d like different icon/text-colors depending on whether the button is clicked or not.
Must have something to do with: iconColor: ‘=(openWBVerbindung_openWB_LP1_lademodus.state === “0”) ? “blue” :
“grey”’

I tried “==” instead of “===” and also without “.state” but neither worked. Probably quite simple, but since I’m rather new to this, I don’t find the solution …

    - component: oh-button
      config:
        class:
          - margin
          - display-flex
          - flex-direction-column
        action: command
        actionItem: openWBVerbindung_openWB_LP1_lademodus
        actionCommand: ="0"
        icon-f7: arrow_2_circlepath
        iconColor: '=(openWBVerbindung_openWB_LP1_lademodus.state === "0") ? "blue" :
          "grey"'
        text: Sofortladen
        textColor: '=(openWBVerbindung_openWB_LP1_lademodus.state === "0") ? "blue" :
          "gray"'

See Building Pages - Components & Widgets | openHAB.

You can and should experiment with expressions in the expression tester in the developer sidebar.

Notice how the Item’s state is referenced.

1 Like

Thank you. Didn’t know about the developers side bar, that’s quite useful, too-