Colors

- r g b mixing

simple

Primitive Alt Action
SetScreenColor [rr gg bb]
SetPenColor
[rr gg bb]
SetSC
SetPC
Set (background) color of screen to [rr gg bb].
Set color of turtle pen to [rr gg bb].
PenPaint
PenReverse
PenErase
PPT
PX
PE
Set pen to normal paint mode and lower pen.
Set pen to reverse color mode and lower pen.
Set pen to screen color and lower pen.
FindColor [xx yy] FC Return color of pixel at point xx yy, [rr gg bb]. *

Underlined Set can be removed from a primitive name in order to return information.
eg. SetHeading sets the heading of the turtle. Heading returns the heading of the turtle.

* turtle position and heading remain unchanged.

Colors are set by a list of the three primary colors of light; red, green and blue. Each color varies in intensity from 0 (min) to 255 (max).

Pen Colors
As well as an [rr gg bb] list, pen and stage color can be set by (but not return) a name or single number.
So, SetPC 2 = SetPC Green = SetPC [0 255 0].
See RGB Cols and Swatches (Light&Dark) and Swatches (RGB).

Color Palettes
0 0 0
Black 0
255 0 0
Red 1
0 255 0
Green 2
255 255 0
Yellow 3
0 0 255
Blue 4
255 0 255
Magenta 5
0 255 255
Cyan 6
255 255 255
White 7
128 128 128
Gray 8
192 192 192
LightGray 9
128 0 0
DarkRed 10
0 128 0
DarkGreen11
0 0 128
DarkBlue 12
255 128 0
Orange 13
255 175 175
Pink 14
128 0 255
Purple 15
153 102 0
Brown 16

By rearranging the values 0, 128 and 255 we can create four more colors besides Orange and Purple. Aqua and Leaf are the most different (useful). Lime is similar to Green and Rose is similar to Magenta. Aqua, Leaf, Lime and Rose are library procedures.

0 128 255
Aqua
0 255 128
Leaf
128 255 0
Lime
255 0 128
Rose

Note

  1. Aqua, Leaf, Lime and Rose are four extra colors used in many programs. Along with Orange and Purple they comprise the 6 arrangements of values 0, 128 and 255. See Alternative Colors for more color rgb values.
  2. SetSC will wash the drawing area and reset the turtle to the home position.
  3. PX works by subtracting the current pen color from the screen color to generate a 'difference' color. This is then added to colors the pen draws over. So if it draws over the same color as the pen color the result will be the screen color.