User Tools

This is an old revision of the document!


Shapes can exhibit different colors. And just like the other transformations, adding color to a shape produces a new shape, one with color.

NOTE: 2D shapes cannot exhibit colors today. This is a known issue.


Color names are case-insensitive, e.g. 'RED' is the same as 'red'.

The CSG library functions can also be used. NOTE: Deprecated in the V2 API


The CSG library functions use RGB values between 0 and 1, not 0 and 255.

See the [ Extended Color Keywords] for all available colors.

Note: There are some Transparency_Sorting|OpenGL Transparency Limitations, e.g. and depending on the order of colors, you might not see through otherwise partially transparent objects.

Color Space Conversion

Following functions to convert between color spaces.

var hsl = rgb2hsl(r,g,b); // or rgb2hsl([r,g,b]);
var rgb = hsl2rgb(h,s,l); // or hsl2rgb([h,s,l]);
var hsv = rgb2hsv(r,g,b); // or rgb2hsv([r,g,b]);
var rgb = hsv2rgb(h,s,v); // or hsv2rgb([h,s,v]);


  • r,g,b (red, green, blue)
  • h,s,l (hue, saturation, lightness)
  • h,s,v (hue, saturation, value)

E.g. to create a rainbow, t = 0..1 and .setColor(hsl2rgb(t,1,0.5))

See the Tor (multi-color) for an example.