# Changing tank color on the fly

**URL:** <https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [December 3, 2024, 6:45pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377 "2024-12-03T18:45:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alfie\_Inman](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Alfie\_Inman](https://forum.inductiveautomation.com/u/Alfie_Inman)\
**Post date:** [December 3, 2024, 6:45pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/1 "2024-12-03T18:45:37Z")

</div>

Hello there, I'm very new to Ignition and have run into a problem. I'm trying to change the color of a cylindrical tank depending on an input (rgb values). I've bound the property to an expression that correctly updates when viewed in the editor, but the tank itself never changes color unless I set it manually in the selector. Is there any way around this or is that just how the tank is implemented?  
Thanks

---

<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:** [December 3, 2024, 6:48pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/2 "2024-12-03T18:48:18Z")

</div>

Show the expression you are using to return the color and how you have configured the binding.

---

<div class="post-metadata">

**Author:** ![Alfie\_Inman](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Alfie\_Inman](https://forum.inductiveautomation.com/u/Alfie_Inman)\
**Post date:** [December 3, 2024, 7:03pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/3 "2024-12-03T19:03:11Z")

</div>

Its an expression binding:  
color({../NumberEntry\_Red.props.value},{../NumberEntry\_Green.props.value},{../NumberEntry\_Blue.props.value})  
When viewed in the perspective property editor its shows java.awt.Color[r=255,g=255,b=0], along with the correct color.

---

<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:** [December 3, 2024, 7:13pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/4 "2024-12-03T19:13:17Z")

</div>

I think it needs to be string not a `java.awt.Color`. Try this

```python
stringFormat(
	'#%02X%02X%02X',
	{../NumberEntry_Red.props.value},
	{../NumberEntry_Green.props.value},
	{../NumberEntry_Blue.props.value}
)

```

---

<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:** [December 3, 2024, 7:14pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/5 "2024-12-03T19:14:48Z")

</div>

The `color()` expression is incompatible with perspective. You need to have the expression provide either the hexadecimal code, or a CSS color function string.

---

<div class="post-metadata">

**Author:** ![Alfie\_Inman](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Alfie\_Inman](https://forum.inductiveautomation.com/u/Alfie_Inman)\
**Post date:** [December 3, 2024, 7:17pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/6 "2024-12-03T19:17:30Z")

</div>

That worked perfectly, thanks a ton!

---

<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:** [December 3, 2024, 7:20pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/7 "2024-12-03T19:20:08Z")

</div>

Mark as solution 👉 👈 🥹

---

<div class="post-metadata">

**Author:** ![Alfie\_Inman](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@Alfie\_Inman](https://forum.inductiveautomation.com/u/Alfie_Inman)\
**Post date:** [December 3, 2024, 7:42pm UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/8 "2024-12-03T19:42:41Z")

</div>

Sorry! First time posting.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [December 4, 2024, 9:11am UTC](https://forum.inductiveautomation.com/t/changing-tank-color-on-the-fly/99377/9 "2024-12-04T09:11:58Z")

</div>

for perspective the string `rgb(255,255,0)` would also work
