Set the color used when rendering.

After calling color() all subsequent rendering will use the specified color value. Color values must be in the range 0.0 to 1.0. There a number of different ways this function can be called. See the examples section below for usage.

syntax

color(grey)
color(r, g, b)
color(r, g, b, a)
color([r, g, b])
color([r, g, b, a])

paramaters

grey grey-scale value
r red value
g green value
b blue value
a alpha (transparency) value

examples

set color with grey-scale value

def display():
   lighting(False)

   translateX(-5)
   color(0.1)
   cube(3.0)

   translateX(5)
   color(0.5)
   cube(3.0)

   translateX(5)
   color(0.9)
   cube(3.0)

set color using rgb values

def display():
   lighting(False)
   color(0.0, 1.0, 1.0)
   cube(3.0)

set color using rgb list

def display():
   lighting(False)
   color([1.0, 1.0, 0.0])
   cube(3.0)

set color using variable

def display():
   lighting(False)
   my_color = [1.0, 0.0, 1.0]
   color(my_color)
   cube(3.0)

set color using alias

def display():
   lighting(False)
   color(blue)
   cube(3.0)