RGB

The RGB function returns a color based on the specified Red, Green, and Blue components. The RGB function can be used to hard code colors, for example, to hard code colors on a Mimic so that the colors alter to indicate changes in state.

Function Name

RGB

Description

Returns a color.

Arguments

RGB(INTEGER, INTEGER, INTEGER)

The first integer value represents the amount of red, the second integer value represents the amount of green, and the final integer value represents the amount of blue. Each color can be in the range 0 to 255.

Returns

INTEGER

The integer value that is returned represents a color.

To reference a color in an expression:

  1. Position the cursor at the location in the expression where the color is to be inserted. If you highlight part of the expression, the color will replace the highlighted code.
  2. Either:
    1. Select the browse button next to the expression field on the expression window.
      A context sensitive menu is displayed.
    2. Select the Color option to display a color palette.
    3. Either select a color from the palette or select the ... option to display the Custom Color window. You can use the Custom Color window to create your own colors (see Using the Color Window in the Geo SCADA Expert Guide to Mimics).
    4. When you have selected a color, an RGB function for the color is entered into the expression. For example, RGB(0,0,204) is a dark shade of blue.

    Or:

    • Enter the RGB function and arguments using the syntax shown in the table above.

Alternatively, you can reference the appropriate OPC color tag of a database item. For example, on a Mimic you could configure a Mimic object to reference the Background Blink color tag of a point. Referencing a color tag can reduce the amount of configuration required should you ever need to use a different color. For more information, see FillColour.

Example:

The following expression is used to animate the FillColour property of a shape on a Mimic.

IIF (".Digital Input 1"=0, RGB( 0, 255, 0 ), RGB (255, 0, 0))

This IIF statement sets the shape to be green - RGB (0, 255, 0) - when a digital point named 'Digital Input 1' is in state 0, and red - RGB ( 255, 0, 0) - when the digital point is in any other state.


Disclaimer

Geo SCADA Expert 2022