DADiSP Worksheet Functions > Function Categories > Colors > COLORTORGB

 

COLORTORGB

Purpose:

Returns the RGB values of a color index.

Syntax:

COLORTORGB(cindex)

(r, g, b) = COLORTORGB(cindex)

cindex

-

An integer. The color index value.

Returns:

An integer, the RGB palette value if successful, else -1.

 

(r, g, b) = COLORTORGB(cindex) returns the individual RGB components in the range 0.0 to 1.0.

Example:

rgbval = colortorgb(yellow);

 

rgbval == 65535 == 0x00FFFF

 

Returns the RGB palette value for the color YELLOW.

Example:

cindex = defcolor("Money", 0.753, 0.863, 0.750);

(r, g, b) = colortorgb(cindex);

 

r == 0.753

g == 0.863

b == 0.750

 

Defines a new color named Money where COLORTORGB returns the same individual RGB components as specified in DEFCOLOR.

Remarks:

See RGBTOCOLOR to returns a color index from RGB values.

 

See STRCOLOR to convert a color index into a color name.

 

See COLORSTR to convert a color name into a color index.

 

See GETRGB to return the RGB values of an image.

 

See WEBCOLORS to define a set of web compatible colors.

See Also:

COLORSTR

DEFCOLOR

GETRGB

RGBTOCOLOR

STRCOLOR

WEBCOLORS