# SetFGColor(r:Red, g:Green, b:Blue {,a:Alpha}) hash function
Valid for use with hash command: HMI Arguments may be specified as Name:Value Pairs
Implemented on the following platforms: HMi430, Android, Windows (except Alpha)
Sets the foreground (text) colour for future display hash functions to the colour specified by Red, Green and Blue components using the RGB colour model. Legal values for each are 0 to 255. The 4th parameter, Alpha, is optional. It controls the transparency. Alpha = 0 gives total transparency, Alpha = 255 makes it totally opaque. Alpha is not implemented in the Windows SimpleHMI client.
Common colours are:
| (255, 255, 255) | White |
| (255, 0, 0) | Red |
| (0, 255 ,0) | Green |
| (0, 0, 255) | Blue |
| (0, 0, 0) | Black |
| (128, 128, 128) | Medium grey |
Example:
# HMI SetFGColour(r:0, g:0, b:255) SetBGColour(255, 0, 0) Print(" Hello World ")
will display the message in blue letters on a red background.
# HMI SetFGColour(0, 0, 255) SetBGColour(255, 0, 0, 100) Print(" Hello World ")
will display the message in blue letters on a semi-transparent red background.
Hint: Colours can be defined using #EQU, to allow easy global changes. Example:
clrRED #EQU "255, 0, 0" clrGREEN #EQU "0, 255, 0" clrBLUE #EQU "0, 0, 255" clrMIDGREY #EQU "128, 128, 128" clrBackground #EQU clrMIDGREY ... # HMI SetFGColour(clrRED) SetBGColour(clrBackground)
You may also use the keywords SetFGColour, FGColourRGB, FGColorRGB
See also SetBGColor, SetColors