Color

COLOR
Use the COLOR statement to set the drawing color in a graphic object. The default drawing color is black. The syntax is as follows:


 * 1) handle COLOR("color" | [r, g, b]) - Set the drawing color to a named color, or to an RGB color

You can use named colors or RGB colors.

**Named Color** To use a named color, enclose the color name in quotation marks like this:
 * 1) handle COLOR("green")

The list of named Run BASIC colors:
 * black
 * blue
 * brown
 * chartreuse
 * cyan
 * darkCyan
 * darkGray
 * darkGreen
 * darkMagenta
 * darkRed
 * gray
 * green
 * lightCyan
 * lightGray
 * lightYellow
 * magenta
 * navy
 * olive
 * orange
 * orchid
 * paleGreen
 * pink
 * purple
 * red
 * royalBlue
 * salmon
 * springGreen
 * veryDarkGray
 * veryLightGray
 * white
 * yellow

A demo that uses one of the named colors to draw a box. code format="vbnet" 'create a graphic object graphic #g, 300, 300

'set the drawing color to be salmon
 * 1) g color("salmon")

'place the drawing pen at 10,10
 * 1) g place(10,10)

'draw a box
 * 1) g box(290, 290)

'add graphic to web page render #g code

**RGB Color** To us an RGB color, separate the values with commas. Values can be in the range of 0 (none of that color) to 255 (full saturation of that color). The following **color** statement creates a color with full red saturation, half green and no blue.


 * 1) handle COLOR(255, 128, 0)

A demo that uses an RGB color to draw a box. code format="vbnet" 'create a graphic object graphic #g, 300, 300

'set the drawing color to be 233,88,125
 * 1) g color(233,88,125)

'place the drawing pen at 10,10
 * 1) g place(10,10)

'draw a box
 * 1) g box(290, 290)

'add graphic to web page render #g code