Syntax
- color(hexValue)
- color(red, green, blue)
- color(red, green, blue, opacity)
Parameters
- hexValue—stringColor to set, in the format "#rrggbb" or "#rrggbboo" (hex).
- red—float (range[0.0, 1.0]) Color to set in red components.
- green—float (range[0.0, 1.0])Color to set in green components.
- blue—float (range[0.0, 1.0])Color to set in blue components.
- opacity—float (range[0.0, 1.0])Color to set in opacity components.
Description
The color operation sets the color of the current shape's material. Input parameter values for red, green, blue, or opacity that are outside the range [0,1] are clamped to [0,1].
In CGA, colors are always in (non-linear) sRGB.
Note:
This command has the same effect as set(material.color.{ r | g | b }, val), it is a shortcut for convenience.
Related
Examples
Three ways to set a shape's color
Three ways to set a shape's color. The results are identical.
|