<< Click to Display Table of Contents >> Navigation: ThinBASIC Core Language > BuiltIn Functions > Numeric functions > RGB |
Description
Return an RGB color value.
Syntax
n = RGB(Red, Green, Blue)
n = RGB(BGRColor)
Returns
Number
Parameters
Name |
Type |
Optional |
Meaning |
Red |
Numeric |
No |
A number from 0 to 255 |
Green |
Numeric |
No |
A number from 0 to 255 |
Blue |
Numeric |
No |
A number from 0 to 255 |
Remarks
An RGB value is a long integer value in the range of 0 to &H00FFFFFF. It is used to specify a color.
The lowest three bytes of the value each specify the intensity of a primary color which combine to form the resultant color.
Byte 1 (lowest) represents the red component, byte 2 the green, and byte 3 the blue. They can each take on a value in the range of 0 to 255.
Byte 4 (highest) is always 0.
When used with 3 parameters, the RGB() function creates an RGB value from the three component values.
When used with one parameter, this function translates a BGR value to its RGB equivalent by swapping the first byte with the third byte, and returning the result.
For example, the BGR value of red is &H000000FF. RGB() translates it to &H00FF0000. Calling BGR() with that value converts it back to &H00FF0000.
Restrictions
See also
Examples