Colordef can be used to define a new color (when color_name does not already exist) or to change the definition of an existing color (when color_name is one of the built-in color names or a name defined previously with colordef). While both color_name and existing_color_name can contain letters, digits, and underscores, only existing_color_name can contain spaces. The existing_color_name can be any color name that can be used with the command color, except byatom or byelement. Caution is warranted in redefining existing colors, because the results can be confusing. For example, "black" can be redefined to indicate a color that is not actually black.
The red, green, blue, and alpha arguments must be floating point numbers between zero and one, inclusive. The alpha value denotes transparency, where 0.0 means completely transparent (invisible) and 1.0 means completely opaque (the default).
Example Color Definitions | |||
---|---|---|---|
color name | red | green | blue |
red | 1.0 | 0.0 | 0.0 |
green | 0.0 | 1.0 | 0.0 |
blue | 0.0 | 0.0 | 1.0 |
cyan | 0.0 | 1.0 | 1.0 |
magenta | 1.0 | 0.0 | 1.0 |
yellow | 1.0 | 1.0 | 0.0 |
white | 1.0 | 1.0 | 1.0 |
black | 0.0 | 0.0 | 0.0 |
Examples:
colordef lilac 0.5 0.5 1.0- create a color named lilac
colordef activesite red- create a color named activesite which is actually red
Colorpanel, fromeditor, and editor are special color names that indicate the current Color Editor color. Colordef can be used to save the current Color Editor color to a name before the color is changed, for example:
colordef myblue colorpanel
See also: color, bondcolor, ribcolor, modelcolor, rangecolor, the Color Editor