Selecting Colors for Different States

All right, it looks like I have another challenge on my hands.

I’m adding an options screen to my HMI in which the user can choose virtually any color to represent a state (empty, failed, etc.). Currently, I’m using a dropdown component containing a list of all colors with names (AliceBlue, AntiqueWhite, etc.).

I think users would prefer to see actual colors rather than names alone, but I don’t know how to display both labels and colors in a dropdown list. I could use color mapping, but there are so many colors to choose from that this seems too impractical.

I suppose I could ask for RGB integers instead, but that could be too confusing.

Is there another way to do this, or should I not use a dropdown list?

You can use Jython to pop up a color chooser window. Here’s an example from the help docs. I would use a mouseClick event on the object whose color you wish to set.

parent = event.source.parent newColor = fpmi.gui.chooseColor(parent.background) parent.background = newColor

You would need to change the parent.background to the path of the color property that you are modifying. You can use the Jython chain link icon to browse to the path.

note: the first parent.background specifies the initial color to the chooser window while the second sets the color.

Thanks a lot! This will save me a lot of time.

No problem! Did you get it customized to work for your application?