Drawing Functions

These functions create and manipulate color values for use in UI bindings and drawing expressions.


RGB

RGB([Alpha,] Red, Green, Blue)

Creates a color from its red, green, and blue (and optionally alpha) components. Each component is an integer in the range 0–255.

Parameter Description
Alpha (optional) Opacity: 0 = fully transparent, 255 = fully opaque. Default is 255.
Red Red component (0–255)
Green Green component (0–255)
Blue Blue component (0–255)

Returns: Color

Examples:

RGB(255, 0, 0)            ' opaque red
RGB(0, 128, 0)            ' medium green
RGB(128, 0, 0, 255)       ' semi-transparent red (Alpha=128)

Named color constants are also available without calling RGB:

vbRed, vbGreen, vbBlue, vbYellow, vbWhite, vbBlack, vbCyan, vbMagenta

ColorToInt

ColorToInt(Color)

Converts a Color value to its ARGB integer representation (Alpha in the high byte).

Returns: Integer

Examples:

ColorToInt(RGB(255, 0, 0))     ' -65536 (red as ARGB int)
ColorToInt(vbBlue)

Useful for storing a color in a numeric field or comparing colors numerically.


ColorToString

ColorToString(Color)

Converts a Color value to its string representation (e.g. a hex color string or named color).

Returns: String

Examples:

ColorToString(RGB(255, 0, 0))    ' "#FFFF0000" or "Red"
ColorToString(vbBlue)