# Set color using "Set Property" script builder

**URL:** <https://forum.inductiveautomation.com/t/set-color-using-set-property-script-builder/24698>\
**Category:** Ignition\
**Created:** [May 6, 2019, 3:59pm UTC](https://forum.inductiveautomation.com/t/set-color-using-set-property-script-builder/24698 "2019-05-06T15:59:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bboth](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@bboth](https://forum.inductiveautomation.com/u/bboth)\
**Post date:** [May 6, 2019, 3:59pm UTC](https://forum.inductiveautomation.com/t/set-color-using-set-property-script-builder/24698/1 "2019-05-06T15:59:22Z")

</div>

Hello,

How do I properly enter a color value into the “To this value:” field of the Set Property script builder? I am trying to change the foreground color of a label on mouse entered event. I thought this would be very simple using Set Property, but it doesn’t accept my value format. I tried entering the value the following ways:  
0,0,0  
(0,0,0)  
system.gui.color(0,0,0)  
color(0,0,0)  
“0,0,0”

None of them work, obviously. It’s giving me the this error:

[ Traceback (most recent call last):  
File “event:mouseEntered”, line 7, in   
TypeError: can’t convert u’0,0,0’ to java.awt.Color ]

Any help would be much appreciated.

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:** [May 6, 2019, 4:45pm UTC](https://forum.inductiveautomation.com/t/set-color-using-set-property-script-builder/24698/2 "2019-05-06T16:45:42Z")

</div>

You can not do this out of the box from the script builder.

From the manual:

> The new value can be a literal value or the value of any other property

You have 2 options:

1.) Create a custom property on the label (or root container), and set the property to that color.  
2.) Use the script editor

Good news though, you can use the script builder to do most of the work for you. Just enter system.gui.color(0,0,0,255) into the 'To this value' field and then switch over to the script editor tab.

You'll be presented with something like this:

```auto
# This script was generated automatically by the property set
# script builder. You may modify this script, but if you do,
# you will not be able to use the property set builder to update
# this script without overwriting your changes.

value = u'system.gui.color(0,0,0,255)'
event.source.foreground = value

```

Now all you need to do us remove the string identifiers from the code so that you end up with this:

```auto
# This script was generated automatically by the property set
# script builder. You may modify this script, but if you do,
# you will not be able to use the property set builder to update
# this script without overwriting your changes.

value = system.gui.color(0,0,0,255)
event.source.foreground = value

```

Now when your mouse enters the label the foreground color will be changed.

---

<div class="post-metadata">

**Author:** ![bboth](https://avatars.discourse-cdn.com/v4/letter/b/e495f1/32.png) [@bboth](https://forum.inductiveautomation.com/u/bboth)\
**Post date:** [May 6, 2019, 4:49pm UTC](https://forum.inductiveautomation.com/t/set-color-using-set-property-script-builder/24698/3 "2019-05-06T16:49:20Z")

</div>

Got it. Thanks lrose!
