Tymless Tutorial: Data



   
  < text

Colours

 
structures >
 

Drawing

Control

Data

Reference

 

You can assign a colour to a variable using the rgb or hsv functions:

acolour = rgb(1,0,0)

or simply by picking up the current turtle colour:

bcolour = $c

You can then use the system properties of the colour to alter it. These are .$r, .$g, .$b, .$h, .$s and .$v.

// colour manipulation via system properties
colA = rgb(1,0,0)
colA.$v = .5   // make the colour darker
$c = colA
{}

Tymless also has some functions to manipulate colours, such as invert.

 

   
  < text
 
structures >