Skip to content

RGB

Returns a Long representing an RGB colour value.

Syntax: RGB( red , green , blue )

red
required A number in the range 0--255 representing the red component of the colour.
green
required A number in the range 0--255 representing the green component of the colour.
blue
required A number in the range 0--255 representing the blue component of the colour.

Application methods and properties that accept a colour specification expect a number representing an RGB colour value: the relative intensity of red, green, and blue that produces a particular shade. The value of any argument that exceeds 255 is treated as 255.

The following table lists some standard colours and the red, green, and blue values they include:

ColourRedGreenBlue
Black000
Blue00255
Green02550
Cyan0255255
Red25500
Magenta2550255
Yellow2552550
White255255255

Example

This example uses RGB to construct several colour values.

vb
Dim Red As Long, RGBValue As Long, I As Long
Red = RGB(255, 0, 0)                  ' Pure red.
I = 75
RGBValue = RGB(I, 64 + I, 128 + I)    ' Same as RGB(75, 139, 203).

See Also

twinBASIC and LOGO copyright of "WaynePhillipsEA" author