Datatype color

A color consists of four floating point numbers: It contains the red, green and blue parts of a color. The fourth component is used to store the opacity (alpha value) of the color.
There is no “color constant” in ChaosPro: In order to create and assign colors you can use one of several functions which return colors:

  • rgb – lets you create a color by specifying the red, green and blue part.
  • rgba – lets you create a color by specifying the red, green, blue and alpha part.
  • hsl – lets you create a color by specifying its hue, saturation and luminance
  • hsla – lets you create a color by specifying its hue, saturation, luminance and alpha
  • gradient – lets you extract a color from the current gradient, i.e. the color path defined by the current palette.

Examples

  color c1,c2;      c1 = rgb(0.3,1.0,0.3); // Assigns a color to c1    c2 = gradient(0.3);    // Extracts the color at position 0.3 from the current gradient  

Colors are internally stored as four floating point numbers which use the 32 bit IEEE single precision format.

color