# Changing the color of progress bar based on a value

**URL:** <https://forum.inductiveautomation.com/t/changing-the-color-of-progress-bar-based-on-a-value/98484>\
**Category:** Ignition\
**Created:** [November 11, 2024, 7:52pm UTC](https://forum.inductiveautomation.com/t/changing-the-color-of-progress-bar-based-on-a-value/98484 "2024-11-11T19:52:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mitchell\_Gerber](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@Mitchell\_Gerber](https://forum.inductiveautomation.com/u/Mitchell_Gerber)\
**Post date:** [November 11, 2024, 7:52pm UTC](https://forum.inductiveautomation.com/t/changing-the-color-of-progress-bar-based-on-a-value/98484/1 "2024-11-11T19:52:39Z")

</div>

I am trying to change color of the progress bar based on a value. Should be green when its greater than 0 and when greater than the low set point, yellow when it's over the alarm setpoint, and red when it's over the shutdown setpoint. I have the script shown below but it isn't working how I need it to.  
 ![Picture1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/deef5b1376fef28ba20045890476b06b7cf16335.png)

---

<div class="post-metadata">

**Author:** ![Kevin\_Flener](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kevin\_Flener](https://forum.inductiveautomation.com/u/Kevin_Flener)\
**Post date:** [November 11, 2024, 8:07pm UTC](https://forum.inductiveautomation.com/t/changing-the-color-of-progress-bar-based-on-a-value/98484/2 "2024-11-11T20:07:11Z")

</div>

Please review:

> [@Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831):
>
> This thread is intended as a short help file for all those struggling to post formatted code on the forum. Code block formatting Posting formatted code on the forum (and most others) is as simple as selecting the code and pressing the \</\> button. It works the same as applying Bold or Italic styles to your document. It preserves indentation and applies syntax highlighting. [How to post code] Note that all the \</\> button does is add three backticks ``` on the line before the code block and anot…

---

<div class="post-metadata">

**Author:** ![Mitchell\_Gerber](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@Mitchell\_Gerber](https://forum.inductiveautomation.com/u/Mitchell_Gerber)\
**Post date:** [November 11, 2024, 8:20pm UTC](https://forum.inductiveautomation.com/t/changing-the-color-of-progress-bar-based-on-a-value/98484/3 "2024-11-11T20:20:35Z")

</div>

```
if((tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke') >= 0), color(71,255,71), 

if((tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke') > tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke-Low')), color(71,255,71), 

if((tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke') > tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Alarm')), color(255,255,0), 

if((tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke') > tag('[default]VIB-01/' + {Stroke Monitor.Side} + '/' + {Stroke Monitor.ItemName} + '-Stroke-Shutdown')), color(255,0,0),

color(128,128,128)

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 11, 2024, 8:31pm UTC](https://forum.inductiveautomation.com/t/changing-the-color-of-progress-bar-based-on-a-value/98484/4 "2024-11-11T20:31:38Z")

</div>

1. Please tag your question as `vision` or `perspective`. You're using the `color()` function which only works in Vision. See the note in [color | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/colors/color).

2. 

> I have the script shown below ...

That's an expression, not a script. (Technicality but an important one.)

1. 

> ... but it isn't working how I need it to.

What is it returning?

1. What property of the component has this expression binding?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 11, 2024, 8:47pm UTC](https://forum.inductiveautomation.com/t/changing-the-color-of-progress-bar-based-on-a-value/98484/5 "2024-11-11T20:47:41Z")

</div>

you shouldn't be using the tag function, you should be creating custom properties and binding your tags to those, then using the custom props in your expressions. Using the tag function has performance drawbacks. You should only ever use these in expression tag expressions
