# Changing the transparency (alpha) of a color using bindings

**URL:** <https://forum.inductiveautomation.com/t/changing-the-transparency-alpha-of-a-color-using-bindings/101865>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [February 4, 2025, 8:07pm UTC](https://forum.inductiveautomation.com/t/changing-the-transparency-alpha-of-a-color-using-bindings/101865 "2025-02-04T20:07:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bradley\_Thompson](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Bradley\_Thompson](https://forum.inductiveautomation.com/u/Bradley_Thompson)\
**Post date:** [February 4, 2025, 8:07pm UTC](https://forum.inductiveautomation.com/t/changing-the-transparency-alpha-of-a-color-using-bindings/101865/1 "2025-02-04T20:07:09Z")

</div>

Hey folks,

Brand new to Ignition and this forum.

I'm trying to make an indicator light template. I would like the user to supply the color ("red", "yellow", or "green") at instantiation. If the light is on I want the color to be the user supplied value. If it's off I want it to be the supplied value with an alpha of 10. I have two internal properties. One named color of type color and one named On of type Boolean.

I've tried

if({IndicatorLight.On},IndicatorLight.Color,IndicatorLight.Color+"33")

in the Fill Paint binding, but no luck.  
This works for green

if({IndicatorLight.On},"00ff00","#00ff00"+"33")

so I know I'm on the right track, just not sure how to make color a string and append the "33". Any thoughts?

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [February 4, 2025, 8:26pm UTC](https://forum.inductiveautomation.com/t/changing-the-transparency-alpha-of-a-color-using-bindings/101865/2 "2025-02-04T20:26:44Z")

</div>

Color is a color object, and I don't believe there is any way to cast it as usable string in an expression. Using `toString` gives you `color( ##,##,##,###)`.

However, if you bind a string custom property to a color custom property, it turns it into a hex string. You might be able to (ab)use that to your advantage.

Your second expression is using a hex string, hence your ability to concatenate the transparency.

---

<div class="post-metadata">

**Author:** ![Bradley\_Thompson](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Bradley\_Thompson](https://forum.inductiveautomation.com/u/Bradley_Thompson)\
**Post date:** [February 4, 2025, 9:09pm UTC](https://forum.inductiveautomation.com/t/changing-the-transparency-alpha-of-a-color-using-bindings/101865/3 "2025-02-04T21:09:54Z")

</div>

If I make .Color a string and assign a value #00FF00 (no quotes) this works.

if({IndicatorLight.On},{IndicatorLight.Color},{IndicatorLight.Color}+"33")

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 4, 2025, 9:13pm UTC](https://forum.inductiveautomation.com/t/changing-the-transparency-alpha-of-a-color-using-bindings/101865/4 "2025-02-04T21:13:00Z")

</div>

Not sure if this is what you are looking for, but there are color expressions like `darker` and `brighter`  
[Colors | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/colors)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [February 4, 2025, 9:13pm UTC](https://forum.inductiveautomation.com/t/changing-the-transparency-alpha-of-a-color-using-bindings/101865/5 "2025-02-04T21:13:32Z")

</div>

> [@Bradley\_Thompson](#):
>
> If I make .Color a string and assign a value #00FF00 (no quotes) this works.

Because you changed it from a `color` type to a `string` type. Strings allow concatenation, colors do not. The color picker may allow you to use Hex color strings but behind the scenes(in vision) its a `java.awt.color`, its just automatically converted for you.

That aside the only way to do named colors in vision is to use `toColor`, which gives you a color object.

> **[toColor | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/type-casting/toColor)**
>
> This function tries to convert value to a color.
