# Changing Foreground Color using Expression property on a label

**URL:** <https://forum.inductiveautomation.com/t/changing-foreground-color-using-expression-property-on-a-label/70305>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [February 24, 2023, 7:02pm UTC](https://forum.inductiveautomation.com/t/changing-foreground-color-using-expression-property-on-a-label/70305 "2023-02-24T19:02:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Puente](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Joseph\_Puente](https://forum.inductiveautomation.com/u/Joseph_Puente)\
**Post date:** [February 24, 2023, 7:02pm UTC](https://forum.inductiveautomation.com/t/changing-foreground-color-using-expression-property-on-a-label/70305/1 "2023-02-24T19:02:19Z")

</div>

I have a label where the Text is bound to a numeric value (numberFormat({Tag/Path/Here},"#0.0")+" PSI") .

I am changing the foreground color from white to red if the value is below 12.

if ({Tag/Path/Here}\< 12,  
COLOR(255,0,0),COLOR(255,255,255))

I want to change the foreground color to red if the value is less than 12 and greater than16. Just adding in "... or \> 16..."  
doesn't seem to work. Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [February 24, 2023, 7:18pm UTC](https://forum.inductiveautomation.com/t/changing-foreground-color-using-expression-property-on-a-label/70305/2 "2023-02-24T19:18:27Z")

</div>

You need two separate compares.

```auto
if({tag} < 12 || {tag} > 16, COLOR(255,0,0),COLOR(255,255,255))

```

Alternatively, you can use hex directly without calling `COLOR()`

```auto
if({tag} < 12 || {tag} > 16, "#FF0000","#FFFFFF")

```

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [February 24, 2023, 7:20pm UTC](https://forum.inductiveautomation.com/t/changing-foreground-color-using-expression-property-on-a-label/70305/3 "2023-02-24T19:20:03Z")

</div>

To go one step further (if this is something you're going to want to do multiple times), you could embed the label in a view, add one property, and change the style based on that property. Then you can do more complex things in your style.

---

<div class="post-metadata">

**Author:** ![Joseph\_Puente](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@Joseph\_Puente](https://forum.inductiveautomation.com/u/Joseph_Puente)\
**Post date:** [February 24, 2023, 7:31pm UTC](https://forum.inductiveautomation.com/t/changing-foreground-color-using-expression-property-on-a-label/70305/4 "2023-02-24T19:31:12Z")

</div>

I am learning as I go and this Ignition Forum is invaluable!

I ended up using || instead of OR

Thanks you!

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [February 24, 2023, 7:56pm UTC](https://forum.inductiveautomation.com/t/changing-foreground-color-using-expression-property-on-a-label/70305/5 "2023-02-24T19:56:17Z")

</div>

Syntax error on my part. Hard to keep it straight all the time between expressions and scripts when I'm just writing here on the forum.
