# Vision Theme Colors

**URL:** <https://forum.inductiveautomation.com/t/vision-theme-colors/104355>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [March 28, 2025, 9:26am UTC](https://forum.inductiveautomation.com/t/vision-theme-colors/104355 "2025-03-28T09:26:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![770043297](https://avatars.discourse-cdn.com/v4/letter/7/b9bd4f/32.png) [@770043297](https://forum.inductiveautomation.com/u/770043297)\
**Post date:** [March 28, 2025, 9:26am UTC](https://forum.inductiveautomation.com/t/vision-theme-colors/104355/1 "2025-03-28T09:26:34Z")

</div>

Define color

 ![1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8fbd03d282cce5e81785172eb4007cafc469e986.png)  
Use color  
 ![2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/6951dc68a8d84b3b5c566212e8b35e6daab0b0fe.png)  
Is this reasonable, or is there a better way?  
Thank you

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 28, 2025, 11:03am UTC](https://forum.inductiveautomation.com/t/vision-theme-colors/104355/2 "2025-03-28T11:03:35Z")

</div>

> [@770043297](#):
>
> Is this reasonable, or is there a better way?

No, because you're not returning a `Color` you're returning a `String`. I would be surprised if that works at all.

Vision has access to the java.awt.Color class, you should use that if you're setting the color by script.

In the expression language the `Color()` expression will return a java.awt.Color object, so for red you would use `Color(255,0,0)` the expression also accepts an optional alpha value.

In vision, the common practice is to use Client tags to hold theme values, for instance you might have a Client Expression Tag `[client]Themes/Light/Colors/Faulted` which has the expression above in it.

Generally, I would create a Theme UDT, and then have an instance of that UDT for each theme. Then indirectly bind the component properties to correct color based on the users theme selection and the desired function.

---

<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:** [March 28, 2025, 2:41pm UTC](https://forum.inductiveautomation.com/t/vision-theme-colors/104355/3 "2025-03-28T14:41:43Z")

</div>

> [@lrose](#):
>
> I would be surprised if that works at all.

I expect it to work, but it's way less efficient than alternatives.

You're using runScript (moving from relatively fast expressions to relatively slow Jython interpreter overhead) purely to return a literal string, which then has to get regex parsed implicitly by the type coercion on whatever property you've got to turn the literal string value into a color, best effort.

If you're going to create colors in scripting, use `system.gui.color` at least. Better still is client tags, as @lrose mentioned; you can directly read them from expression as Color objects, so you're going to skip a ton of overhead.
