# Images

**URL:** <https://forum.inductiveautomation.com/t/images/1526>\
**Category:** Ignition\
**Created:** [February 11, 2010, 9:12am UTC](https://forum.inductiveautomation.com/t/images/1526 "2010-02-11T09:12:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lifetec](https://avatars.discourse-cdn.com/v4/letter/l/dec6dc/32.png) [@Lifetec](https://forum.inductiveautomation.com/u/Lifetec)\
**Post date:** [February 11, 2010, 9:12am UTC](https://forum.inductiveautomation.com/t/images/1526/1 "2010-02-11T09:12:16Z")

</div>

Hi,  
How do I enter a color as property(java.awt.color) How does this look like?  
#FF0F02 or 245,33,43 or …?

grtz,  
Tijs

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 11, 2010, 10:24am UTC](https://forum.inductiveautomation.com/t/images/1526/2 "2010-02-11T10:24:59Z")

</div>

it looks like #,#,#

---

<div class="post-metadata">

**Author:** ![Lifetec](https://avatars.discourse-cdn.com/v4/letter/l/dec6dc/32.png) [@Lifetec](https://forum.inductiveautomation.com/u/Lifetec)\
**Post date:** [February 11, 2010, 10:38am UTC](https://forum.inductiveautomation.com/t/images/1526/3 "2010-02-11T10:38:25Z")

</div>

Traceback (innermost last):  
File “event:mousePressed”, line 7, in ?  
[color=#FF0040]TypeError: can’t convert ‘0,10,10’ to java.awt.Color[/color]

```
at org.python.core.Py.TypeError(Py.java)
at org.python.core.Py.tojava(Py.java)
at org.python.core.PyBeanProperty._doset(PyBeanProperty.java)
at org.python.core.PyInstance. __setattr__ (PyInstance.java)
at com.inductiveautomation.factorypmi.application.script.PyComponentWrapper. __setattr__ (PyComponentWrapper.java:62)
at org.python.pycode._pyx16.f$0(<event:mousePressed>:7)
at org.python.pycode._pyx16.call_function(<event:mousePressed>)
at org.python.core.PyTableCode.call(PyTableCode.java)
at org.python.core.PyCode.call(PyCode.java)
at org.python.core.Py.runCode(Py.java)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:367)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:138)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:280)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
at $Proxy0.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
```

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [February 11, 2010, 2:58pm UTC](https://forum.inductiveautomation.com/t/images/1526/4 "2010-02-11T14:58:59Z")

</div>

Have a look at Scripting/Python/API Reference/system.gui.color in the help.

You would do something like`event.source.parent.getComponent('Rectangle').background = system.gui.color(0,10,10)`Note that now you can also do`event.source.parent.getComponent('Rectangle').background = system.gui.color("#FF0000")`or even `event.source.parent.getComponent('Rectangle').background = system.gui.color("red")`  
As an aside, I also found that even `event.source.parent.getComponent('Rectangle').background = 0,10,10`(no quotes) works!

---

<div class="post-metadata">

**Author:** ![MickeyBob](https://avatars.discourse-cdn.com/v4/letter/m/e19adc/32.png) [@MickeyBob](https://forum.inductiveautomation.com/u/MickeyBob)\
**Post date:** [February 11, 2010, 3:09pm UTC](https://forum.inductiveautomation.com/t/images/1526/5 "2010-02-11T15:09:37Z")

</div>

I’m unsure exactly what you’re trying to do. If you’re wanting to bind a color to a property you can use one of the following expressions:

1. toColor(“nRed, nGreen, nBlue, nAlpha”)

where nRed, nGreen, nBlue, and nAlpha are integer values from 0 to 255.

1. toColor(“ColorName”)

where ColorName is a named color such as “AliceBlue”, “Aqua”, “Biege”, etc.

1. color(nRed, nGreen, nBlue, nAlpha)  
where, again, nRed, nGreen, nBlue, and nAlpha are integer values from 0 to 255

See the User Manual, Technical Reference\>\>Expression Language\>\>Type Casting Functions\>\>toColor, Technical Reference\>\>Expression Language\>\>Type Casting Functions\>\>Named Color Table, or Technical Reference\>\>Expression Language\>\>Color Functions\>\>color for more details.

Al pretty much covered the subject with regard to Jython scripting.
