Use of Colour

You can assign a colour by using (1) one of 16 inbuilt strings, (2) one of 148 inbuilt TColors or (3) your own red, green and blue values.

The easiest way to assign a colour is to use an inbuilt string with code such as Canvas.StrokeStyle := 'red';. We find the inbuilt strings in the TW3Color unit:
class var vColorNames : array of String =
            [ 'aqua', 'black', 'blue', 'fuchsia', 'green', 'gray',
              'lime', 'maroon', 'navy', 'olive', 'purple', 'red',
              'silver', 'teal', 'white', 'yellow' ];    
If you try a string that is not in this array then the code will be accepted by the translator but the previous value of the colour will be retained.
You can look for an inbuilt TColor at the start of the W3Graphics unit (SmartCL.Graphics in Version 2.1). Examples include clAliceBlue, clAntiqueWhite, clAqua, clAquamarine, clAzure, clBeige and clBisque. Use one with code such as
Canvas.FillStyle := ColorToWebStr(clAliceBlue); 
An example of the use of your own RGB values is
Canvas.FillStyle := 'rgb(189, 200, 179)'; // RobinEggBlue    
An example with an alpha value is
Canvas.FillStyle := 'rgba(0, 255, 0, 0.5)';    

The use of alpha values is vital in Alex Karet's BlendingEllipses.

Programming - a skill for life!

Commonly used routines for drawing on a canvas and the use of another unit, colour, different fonts and transforms