RGB – PB Docs 126

RGB PowerScript function

Description

Calculates the long value that represents the color specified
by numeric values for the red, green, and blue components of the
color.

Syntax

Argument

Description

red

The integer value of the red component
of the desired color

green

The integer value of the green component
of the desired color

blue

The integer value of the blue component
of the desired color

Return Values

Long. Returns the long that represents
the color created by combining the values specified in red, green,
and blue. If an error occurs, RGB returns -1.
If any argument’s value is null, RGB returns null.

Usage

The formula for combining the colors is:

Use RGB to obtain the long value required
to set the color for text and drawing objects. You can also set
an object’s color to the long value that represents the color.
The RGB function provides an easy way to calculate
that value.

note.png About color values

The value of a component of a color is an integer between
0 and 255 that represents the amount of the color that is required
to create the color you want. The lower the value, the darker the
color; the higher the value, the lighter the color.

To determine the values for the components of a color (known
as the RGB values), use the Edit Color Entry window. To access the
Edit Color Entry window, select a color in the color bar at the
bottom of the workspace and then double-click the selected color
when it displays in the first box of the color bar.

The following table lists red, green, and blue values for
the 16 standard colors.

Table 10-9: Red, green, and blue color values for use with RGB

Color

Red value

Green value

Blue value

Black

0

0

0

White

255

255

255

Light Gray

192

192

192

Dark Gray

128

128

128

Red

255

0

0

Dark Red

128

0

0

Green

0

255

0

Dark Green

0

128

0

Blue

0

0

255

Dark Blue

0

0

128

Magenta

255

0

255

Dark Magenta

128

0

128

Cyan

0

255

255

Dark Cyan

0

128

128

Yellow

255

255

0

Brown

128

128

0

Examples

This statement returns a long that represents black:

This statement returns a long that represents white:

These statements set the color properties of the
StaticText st_title to be green letters
on a dark magenta background:

See Also

  • RGB method
    for DataWindows in the DataWindow Reference or the online Help


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x