DADiSP Worksheet Functions > Function Categories > Colors > COLORSTR

 

COLORSTR

Purpose:

Returns the color index corresponding to a color name.

Syntax:

COLORSTR("name")

"name"

-

A string, the name of the color.

Returns:

An integer, the color number.

Example:

colorstr("blue")

 

returns 1.

Example:

colorstr(strcolor(13))

 

returns 13, indicating COLORSTR and STRCOLOR are inverse functions.

Remarks:

Most pre-defined colors also have an associated macro to retrieve the color number. For example, the macro LRED is defined as 12, the color value for light red. The statement

 

colorstr("LRED")

 

also returns 12, so the statements

 

sercolor(lred) and sercolor(colorstr("lred"))

 

are equivalent. However, COLORSTR is useful if the color value does not have an associated name or if the color name includes spaces. For example:

 

defcolor("Sky Blue", 0.651, 0.793, 0.942)

sercolor(colorstr("Sky Blue"))

 

defines a new color named Sky Blue and sets the current series to that color.

See Also:

COLORTORGB

DEFCOLOR

GETWCOLOR

RGBTOCOLOR

STRCOLOR

WEBCOLORS

WINCOLOR