# Changing item/text colors in buttons

**URL:** <https://community.openhab.org/t/changing-item-text-colors-in-buttons/119156>\
**Category:** UIs\
**Tags:** button\
**Created:** [March 17, 2021, 11:27am UTC](https://community.openhab.org/t/changing-item-text-colors-in-buttons/119156 "2021-03-17T11:27:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ursusprimus](https://community.openhab.org/letter_avatar_proxy/v4/letter/u/7ea924/32.png) [@Ursusprimus](https://community.openhab.org/u/Ursusprimus)\
**Post date:** [March 17, 2021, 11:27am UTC](https://community.openhab.org/t/changing-item-text-colors-in-buttons/119156/1 "2021-03-17T11:27:50Z")

</div>

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 …

```auto
    - 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"'

```

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [March 17, 2021, 2:18pm UTC](https://community.openhab.org/t/changing-item-text-colors-in-buttons/119156/2 "2021-03-17T14:18:30Z")

</div>

See [Building Pages - Components & Widgets | openHAB](https://www.openhab.org/docs/ui/building-pages.html#dynamically-configuring-components-with-expressions).

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

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/d/7/d77be75f5b202c06978f9536da813f89645a4a06.png)

Notice how the Item’s state is referenced.

---

<div class="post-metadata">

**Author:** ![Ursusprimus](https://community.openhab.org/letter_avatar_proxy/v4/letter/u/7ea924/32.png) [@Ursusprimus](https://community.openhab.org/u/Ursusprimus)\
**Post date:** [March 17, 2021, 3:09pm UTC](https://community.openhab.org/t/changing-item-text-colors-in-buttons/119156/3 "2021-03-17T15:09:54Z")

</div>

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