# Color depending of value

**URL:** <https://forum.inductiveautomation.com/t/color-depending-of-value/109646>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [August 12, 2025, 3:39pm UTC](https://forum.inductiveautomation.com/t/color-depending-of-value/109646 "2025-08-12T15:39:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alfredo\_Egmo](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Alfredo\_Egmo](https://forum.inductiveautomation.com/u/Alfredo_Egmo)\
**Post date:** [August 12, 2025, 3:39pm UTC](https://forum.inductiveautomation.com/t/color-depending-of-value/109646/1 "2025-08-12T15:39:02Z")

</div>

What is the best method to coloring a Numeric Label or Text Field based on values/expression?

I have 3 options to set the color:

first color - if the value \<x

second color - if the value \>=x and \<=x\*1.10

third color - if the value is \>x\*1.10

thanks

![{A84E227F-B366-4EF4-A8E2-9EB34F22ED75}](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/8/d866d7e4f3d8a1edbb08fb3fb0196147bb9d2631.png)

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [August 12, 2025, 3:46pm UTC](https://forum.inductiveautomation.com/t/color-depending-of-value/109646/2 "2025-08-12T15:46:44Z")

</div>

Use an Expression binding:

```python
if({value} < {x},
	'blue',
	if({value} > {x} * 1.10,
		'red',
		'green'
	)
)

```

---

<div class="post-metadata">

**Author:** ![Alfredo\_Egmo](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Alfredo\_Egmo](https://forum.inductiveautomation.com/u/Alfredo_Egmo)\
**Post date:** [August 12, 2025, 4:09pm UTC](https://forum.inductiveautomation.com/t/color-depending-of-value/109646/3 "2025-08-12T16:09:09Z")

</div>

Thank you, do you know if this is the best way?

Now , if I have the same logic for multiple controls, can I in some way use one global function from all the controls to do this logic? so if the logic changes I can do it only in one place instead of each control…

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [August 12, 2025, 4:16pm UTC](https://forum.inductiveautomation.com/t/color-depending-of-value/109646/4 "2025-08-12T16:16:36Z")

</div>

Well, you could bind the `1.10` to a custom property instead of hardwiring it (as well as the colors themselves). Otherwise I would just point you to something I wish I had known about much sooner:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/3/83738483830de775f61dd96a7d91c87461227957.png)

You could also create a library function and call it with `runScript()` if you want a single point of change that is more flexible. It won’t execute as quickly, but for something as simple as this the difference would probably not be noticeable. I’m all for code reuse when practical, but in Ignition I try to use pure Expressions as much as possible for efficient, responsive displays.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 12, 2025, 4:20pm UTC](https://forum.inductiveautomation.com/t/color-depending-of-value/109646/5 "2025-08-12T16:20:45Z")

</div>

Use the style customizer:

> **[Vision Component Customizers | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/vision/working-with-vision-components/vision-component-customizer#style-customizer)**
>
> The Vision module provides a number of customizers to configure components in ways that are more complex or detailed for basic properties.

You can 'back up' the styles dataset in a (optionally: client) tag and bind all of your components with common styles to that common tag.  
The style customizer offers an easy GUI way to manage _multiple_ types of appearance changes in one go without the overhead of scripting.

---

<div class="post-metadata">

**Author:** ![Alfredo\_Egmo](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Alfredo\_Egmo](https://forum.inductiveautomation.com/u/Alfredo_Egmo)\
**Post date:** [August 12, 2025, 4:21pm UTC](https://forum.inductiveautomation.com/t/color-depending-of-value/109646/6 "2025-08-12T16:21:16Z")

</div>

thank you
