system.gui.chooseColor not returning Alpha value

Is there a way to make the system.gui.chooseColor function return the selected alpha value as well as the RGB values? It doesn’t matter what alpha or transparency is selected, it never gets returned.

Sure it does.

col = system.gui.chooseColor(event.source.parent.background) print col.getAlpha()

1 Like

Ahhhh, interesting. I was just looking at the object that it returned and the alpha wasn’t listed.

java.awt.Color[r=255,g=0,b=204]

Now that makes more sense. Thanks!

Hi, Is there a way we can get the Hexadecimal Value instead of the RGB values of the chosen color?

Not directly through the Java Color object, but you can use a function from TypeUtilities that we use internally with a little extra effort:

from com.inductiveautomation.ignition.common import TypeUtilities
colorString = TypeUtilities.colorToHex(color)
4 Likes