How to create blinking colors with scripting

Hi Everyone,

On our department, we’ve been using several SCADA-systems for a long while. We’re quite enthousiastic about Ignition.
But…
We were used to color management: A color database with named colors like “motorFaulted” (e.g. red) and “conveyerRunning” (e.g. green) and when a cusotmer wanted changes in the color, this could be done in one place…
This way blinking colors could also be created.
Now I find that using colors is somewhat tougher. We’ve made some scripting functions to centralize the colors, but we haven’t been able to use blinking colors in this way…

  1. What are your experiences on this matter
    and
  2. Is it possible to set a blinking color with scripting rather dan using the tag/indirect/property binding…

Thanks for your time and reply :wink:

The easiest way to handle colors, including blinking colors in Ignition is by using style customizers. Have you used that approach? Style customizers can be used on any component.

The Ignition User Manual gives some examples of its use here, including blinking colors: https://docs.inductiveautomation.com/display/DOC79/Component+Customizers

Here is a video from Inductive University: https://www.inductiveuniversity.com/video/component-styles

Certainly you can use Python scripting to centralize colors and implement blinking. You can use the Timer component and templates to implement the functionality and then put it in templates to reuse it. You could store color names and values in tags or in a database so they can be reused within and across projects. Python scripting is the most flexible and powerful way to do just about anything in Ignition.

Hi Nick,

Thanks for the response.
Our solution thusfar has been the following code in a library:

“”"KleurRgb
def gvbKleurConstantenBasis( Zoeksleutel ):

"""
value = project.gvbConstanten.gvbKleurConstanten( Zoeksleutel )
system.gui.getParentWindow(event).getComponentForPath('Root Container').background = value
"""
Const = { 'KLEUR': 'RGBkleuren' } # 1e entry in dictionairy

“”"Vaste kleuren
Const[ ‘KLEUR_ZWART’ ] = ‘#000000’ # Wizcon
Const[ ‘KLEUR_DONKERGRIJS_TRANSPARANT’ ] = ‘48,57,60,50’
Const[ ‘KLEUR_DONKERGRIJS_TRANSPARANT2’ ] = ‘64,64,64,128’
Const[ ‘KLEUR_GRIJS_CBS’ ] = ‘128,128,128’ # Wizcon
Const[ ‘KLEUR_LICHTGRIJS’ ] = ‘192,192,192’ # Wizcon
Const[ ‘KLEUR_LICHTERGRIJS’ ] = ‘213,213,213’ # Wizcon
Const[ ‘KLEUR_KADERGRIJS’ ] = ‘150,150,150’ # Wizcon

....

“”"Vaste kleuren bedienknopppen (buttons)
Const[ ‘KLEUR_BUTTON_ACTIEF’ ] = ‘138,255,255’

# Zoeken in dictionairy met foutafhandeling 
try:
	Resultaat = Const[ Zoeksleutel ]
except KeyError:
	print "ERROR: gvbKleurConstantenBasis(): '" + Zoeksleutel + "' bestaat niet!"
	Resultaat = '#000000'
			
return Resultaat

Without resulting to timers etc. I wondered if like the transparancy, there is some color-string definition that would create a blinking color.
Also the use of the style customizers would indeed create blinking color on specified tag values, but then again this would not be centrally maintained.

With regards,
Martijn

P.S. Some of the coding/constants is/are in Dutch,I guess this doesn’t hinder an experienced programmer…

I’ve also wondered about color management (and also font management) in the past, but didn’t work out anything yet.

What I thought was using tags to define colors. You can define the colors in plain HEX strings, and refer to them by an expression (just browse for the tag and the color will display, direct tag references don’t work AFAIK, as they require you to bind colors to values, but the value is the color already).

Blinking colors are also possible in this way by using a gateway timer script to toggle the hex strings back and forth.

Too bad fonts can’t be bound in such an easy way.

1 Like