DADiSP Worksheet Functions > Function Categories > Colors > DEFCOLOR
Creates or redefines a color.
DEFCOLOR("name", r, g, b, index)
"name" |
- |
Optional. A string, the name of the color. |
r |
- |
A real. The value of the red component for the color |
g |
- |
A real. The value of the green component for the color |
b |
- |
A real. The value of the blue component for the color |
index |
- |
Optional. An integer, the index of the color. Defaults to the index of the next available color. |
An integer, the color index if successful, else -1.
defcolor("Money", 0.753, 0.863, 0.750)
wincolor(colorstr("Money"))
Defines a new color named Money and sets the background color of the current Window to this color. Because DEFCOLOR automatically defines a macro with the same name as the color,
wincolor(money)
produces the same result.
defcolor(0.0, 0.5, 1.0, lblue)
Redefines the existing color LBLUE.
DEFCOLOR automatically defines an integer macro with the same name as the color if the definition is successful. Spaces in the color name are replaced by _ in the macro name. For example:
defcolor("Dull Red", 1.0, 0.5, 0.5)
Defines the macro DULL_RED that can be used in any function accepting a color index. However, the string Dull Red automatically appears in the color selection dialog box.
DEFCOLOR also accepts RGB integer values between 0 and 255. For example:
defcolor("DodgerBlue", 30, 144, 255)
To use this form, each RGB value must be an integer between 0 and 255.
The COLORSTR function converts a color name into a color index.
See WEBCOLORS to define a set of website compatible colors.
Colors can also be define in the system file palette.mac.
See SETPMAP to create a colormap from a list of colors.