RGB Function |
Microsoft.VisualBasic.Information
RGB( red, green, blue )
A number between 0 and 255, inclusive
A number between 0 and 255, inclusive
Data type: Integer
A number between 0 and 255, inclusive
An Integer representing the RGB color value
Returns a system color code that can be assigned to object color properties
The RGB color value represents the relative intensity of the red, green, and blue components of a pixel that produces a specific color on the display.
The RGB function assumes any argument greater than 255 to be 255.
The following table demonstrates how the individual color values combine to create certain colors:
Color | Red | Green | Blue |
---|---|---|---|
Black |
|
|
|
Blue |
|
| 255 |
Green |
| 255 |
|
Red | 255 |
|
|
White | 255 | 255 | 255 |
The RGB value is actually derived using the following formula:
RGB = red + ( green * 256) + ( blue * 65536)
In other words, the individual color components are stored in the opposite order than you would expect. VB stores the red color component in the low- order byte of the integer's low-order word, the green color in the high-order byte of the low-order word, and the blue color in the low-order byte of the high-order word.
Visual Basic now contains a wide range of intrinsic color constants that can be used to assign color values directly to color properties of objects.
QBColor Function