Color Schemes

A color scheme is a collection of colorDB files located in a subdirectory of proj_path/colorDB, for example, WinCC_OA_proj_path/colorDB/DayScheme/<colorDB_name>/<color_name_1>…<color_name_n>. Hence, the name of the scheme is "DayScheme" - the name of the directory.

Note that color schemes cannot be saved in subdirectories of a subdirectory!

The user interface loads all colorDB files and additionally all colorDB files from the active color scheme. Hence, you can overload colors by using a color scheme.

You can set the active color scheme by using the function colorSetActiveScheme() or the config entry activeColorScheme in the UI section of the config file. By setting a color scheme to active, the RGB values of the internal colors of all shapes in opened panels and in the cache are updated with the colors of the new color DB and redrawn. With the aid of the color schemes you can create several color schemes and switch between them. Hence, you can, for example, create different color schemes for day and night.

You can switch between color schemes only on the UI being used!

The following table contains the functions that can be used in connection with the color schemes:

Note that in order to use the functions, open the UI in the -extend mode. Furthermore, the functions cannot be used in a second UI simultaneously since the color database is locked for writing (the error message "Read only colorDB“ is shown).

You can edit the color schemes also in the project view of the graphics editor GEDI.

Note the following limitations when using color schemes:

  • The color selector displays the colors of the standard (default) catalog and additionally the colors of the loaded color schemes. Colors of not yet loaded color schemes are not shown.
  • We recommend to use only colors of the standard (default) catalog (colorDB) for the color schemes. Furthermore, alias names should only be created for the colors in the standard (default) catalog (colorDB). To avoid missing colors at runtime, specify the colors you use in the color schemes also in the default catalog (colorDB file).
  • Color names can be case sensitive under Linux and Windows. Color schemes and color catalog (colorDB) names only under Linux.
  • In certain circumstances the EWO objects might not display the active color.
  • ColorDB files cannot be deleted via script. They can only be deleted in the GEDI.

Example of a Day-Night Color Switch

This example shows you how to use the color schemes. Proceed as follows:

    • Open the graphics editor GEDI and the project view.
Figure 1. Project View and the Color Databases
  • Add two new color Scheme Folders "Day" and "Night" to your project (see figure above).

  • Click on the folder "Day" and add a new color database. Repeat this step for the "Night" folder (see figure above).

  • Add a main (default) color database (see figure above).

  • Add two new colors "background" and "foreground" to the colorDBs via the "Add New Color" option. In this example black and white are used for the day and night schemes and green as a default color (see the figure further below).

Figure 2. Add New Color
Figure 3. Color Schemes and colorDB Files with colors
  • Open, for example, the panel "infoPanel_1680_1050_TEMPLATE1.pnl located in project_path/panels/para/PanelTopology/templates/TEMPLATE1 or create your own panel.

  • Add two buttons and a text field to the panel. In this example images were used for the buttons to illustrate the day/night switch.

Figure 4. Panel with two buttons and a text field
  • Add the following code to the "clicked" event of the "Day" button:

main()
{
  string scheme = "Day";
  colorSetActiveScheme(scheme);
  TEXT_FIELD1.text("Day");
}
  • Add the following code to the "clicked" event of the "Night" button:

main()
{
  string scheme = "Night";
  colorSetActiveScheme(scheme);
  TEXT_FIELD1.text("Night");
}

The color schemes are set to night or day by using the function colorSetActiveScheme() and a text is set to the text field.

  • Activate the color scheme "main" (see figure below).

Figure 5. Activate the Color Scheme "main"
  • Open the panel in a user interface and click the buttons. The color scheme is switched.

Figure 6. Color Scheme "Day"
Figure 7. Color scheme "Night"

"Activate Color Scheme" option

The "Activate Color Scheme" option can be used in addition to the Control functions, to activate a scheme in the user interface. For color schemes, the name of the color scheme is shown for the "Activate Color Scheme" option in the project view (see figure below). The standard (default) catalog does not have a name. Therefore, no name is shown for the standard (default) catalog for the "Activate Color Scheme" option. The option can be selected when clicking a color scheme directory or when clicking a colorDB file. The option can also be used in further GEDI modules (e.g., in two simultaneously opened GEDI modules) in the project view (colorDB).

Figure 8. Activate Color Scheme option