color
A color.
Signatures
- rgb( int red, int green, int blue )
- cmyk( int cyan, int magenta, int yellow, int key )
Details
This data type represents a general color in one of the used color models RGB or CMYK).
A color variable keeps the color model it was constructed with but gets converted automatically when elements of a different color model are requested.
A color can be applied as a modifier onto a solid.
Example
color c = rgb( 255, 0, 255 )
make c >> box()
Example
open color col{
name = "Object Color"
descr = "Select an object color"
value = rgb( 255, 255, 255 )
options = [rgb( 255, 255, 255 ), rgb( 0, 0, 0 ), rgb( 255, 0, 255 ), rgb( 0, 0, 255 )]
options_texts = ["white", "black", "pink", "blue"]
}
Casts To
Members
- string cmode()
-
Allows to read the color mode. This is either "rgb" or "cmyk".
- int r
-
Allows to read/write the red value of the color.
- int g
-
Allows to read/write the green value of the color.
- int b
-
Allows to read/write the blue value of the color.
- int c
-
Allows to read/write the cyan value of the color.
- int m
-
Allows to read/write the magenta value of the color.
- int y
-
Allows to read/write the yellow value of the color.
- int k
-
Allows to read/write the key (black) value of the color.
Optional Open Parameter Attributes
- bool readonly
-
Tells the user interface or frontend to disable the setting of the open parameter.
- string style
-
Specifies some limited styling instructions for the user interface or frontend.
- int expose_opar
-
Controls the visibility state of the open parameter. Possible values are -1 (do not expose), 0 (expose when requested) and +1 (expose).
- color[] options
-
An array of color values that defines a selection of allowed values. The user interface or frontend may use a drop-down list to display this open parameter's control. The system enforces that the open parameter value is of the selection options.
- string[] options_texts
-
This attribute requires an options attribute to be present. The options_texts attribute is an array of string values that should ideally have the same length as the options array. Its function is to provide a short name or description for each of the options values. These may be used in the drop-down list by the user interface or frontend.
Parameters
- red
-
The red value of the RGB color model (0...255).
- green
-
The green value of the RGB color model (0...255).
- blue
-
The blue value of the RGB color model (0...255).
- cyan
-
The cyan value of the CMYK color model (0...255).
- magenta
-
The magenta value of the CMYK color model (0...255).
- yellow
-
The yellow value of the CMYK color model (0...255).
- key
-
The key (black) value of the CMYK color model (0...255).