Dynamic color changing

In our projects we re-use a ton of graphics however we have customers that like to have different colors on the object than what we originally designed into the graphic. So I need to find a way to dynamically change the fill paint color based on a tag or set of tags.

I originally started down the road of using an expression with a toColor function, but then that doesn’t let us do blinking states.
I then started down the road of styles… but I can’t figure out how to do the proper cell update to change the color in the dataset.

I’d like this to be as easy as possible for future changes for our engineers. Any ideas?

Consider using a hierarchy of Client Tags for such things, even as complete style datasets for particular object types. Easy to edit in the designer, cause no runtime traffic after window open, and are saved as part of the project.

I was working on the client tag thing… but I can’t figure out what data to put in a tag to do the cell update to match what is already in there.

For instance one of the fillPaint columns in the style has this as a value: java.awt.Color[r=170,g=170,b=170]

Do I make a string tag that matches that data? Or do I need to derive something else to get this to work?

Copy and paste entire datasets. Or use scripting with the system.gui.toColor() function.

Just to add to this, you could still have the blinking states with a standard expression. You can use a standard timer component (from the Misc palette) in each screen in the project with the “Bound” property set to 2, and “Delay” property set to 1,000 ms. This will result in the timer value property alternating between 0 and 1 every second. You can then reference the current value of this timer inside the color binding so that if it is true it is one color and if it is false it is the other color.

if(
	{generic_data_entry.Timer.value},
	toColor({[Client]Visuals/Colors/status_red}, "B20000"),
	toColor("white")
)

Could also do this within a client tag by checking to see if the current seconds are odd or even to drive the color of the client tag and then reference that client tag in the the color binding on the component.

Couple quick hacks that have worked for me but as Phil said, you can directly modify the Styles property which is more manageable in the long run if you have a LOT of components and/or properties that you want to be able to tweak on each component (either way, templates are definitely your friend here!).

Hope this helps!
-Will

Thanks guys I appreciate the help.

I think I finally got over my mental hurdle on this one. I couldn’t figure out how to do a cell update with a color and then after a cup of coffee I figured out I needed a custom property on the actual component and pass the color into that.

Thanks again for the help. For now I’ve got a workable plan.