The Color class property is used to change the colour of an object, such as a box, a line, or a piece of text. You change the colour by setting values for Blue, Red, and Green - the three RBG values from which all colours are derived in computer graphics. Values are in the range 0-255.
For example, setting Green=255, Red=0 and Blue=0 would produce a green colour. Setting Green=255, Red=255 and Blue=255 would produce white, while Green=0, Red=0 and Blue=0 would produce black.
The Color Class is never called on its own, so you can not write a script such as:
CreditBox.Color.Red := 255 .
Instead, the Color Class is always called by other Object Classes - such as the Border and Fill Class Properties.
Imagine you had a "Credit Worthy" box, normally displayed in green. You could create a script which checked a client's credit rating, and if the rating was poor, the script could alter the "Credit Worthy" Box to a Red display. The syntax would be:
If any CLUBS Credit_Rating = "No Way!" then
CreditBox.Fill.Color.Red := 255 .
CreditBox.Fill.Color.Green := 0 .
CreditBox.Fill.Color.Blue := 0 .
CreditBox.Redraw := 1 .
else
CreditBox.Fill.Color.Red := 0 .
CreditBox.Fill.Color.Green := 255 .
CreditBox.Fill.Color.Blue := 0 .
CreditBox.Redraw := 1 .
End .
the "Redraw" command is necessary, to force the colour change to be displayed on screen.
With a little extra work, you could - depending on the client's exact credit worthiness - gradually shade the Credit Worthy Box from green to red, by decreasing and increasing the relevant colours.
As mentioned above, the three simple properties associated with the Color Class Property are:
Examples of their use are given below.
This property specifies the saturation of blue coloring.
Number.
Set this property to a value between 0 and 255. 0 specifies minimum saturation, 255 specifies maximum.
CreditBox.fill.Color.Blue := 0 .
This property specifies the saturation of green coloring.
Number.
Set this property to a value between 0 and 255. 0 specifies minimum saturation, 255 specifies maximum.
CreditBox.fill.Color.Green := 10 .
This property specifies the saturation of red coloring.
Number.
Set this property to a value between 0 and 255. 0 specifies minimum saturation, 255 specifies maximum.
CreditBox.fill.Color.Red := 128 .