Color

(For a Printable Version Click Here)

StarLogo has 14 "major" colors, with many shades of each. Different shades are associated with different numbers. For example, the shades of red are associated with the numbers between 10 and 20 (not including 20). Number 10 is a very "dark" red (close to black), number 15 is the "purest" red, and number 19 is a "light" red (close to white). Similarly, number 20 is a dark orange, number 25 is the purest orange, and number 29 is a light orange. (Note: Fractional numbers can also represent different shades, if your computer supports enough colors.)

These numbers are used as inputs to the commands setc (which sets the color of turtles) and setpc (which sets the color of patches). So the command ask-patches[setpc 15] will turn all of the patches red, while ask-patches[setpc 19] will turn the patches a much lighter shade of red. Type ask-patches[setpc xcor + ycor] to see the full range of colors. Color numbers greater than 140 "wrap" (using modulo 140).

The organization of colors by shades is very useful for achieving smooth shading effects using the commands scale-color and scale-pc.

There are commands (e.g., black, red, green) that report color values. These commands report the number for the "purest" shade of the color. For example, red reports 15 and orange reports 25. Color names report numbers in the color listing:

black | 0 | gray, grey | 5
white | 9 | red | 15
orange | 25 | brown | 35
yellow | 45 | green | 55
lime | 65 | turquoise | 75
cyan | 85 | sky | 95
blue | 105 | violet, purple | 115
magenta | 125 | pink | 135

A / B
black blue brown
C
color color-at color-of color-towards count-color count-pc cyan
D / E / F / G
gray, grey green
H / I / J / K / L
lime
M
magenta
N
orange
O / P
pc, patchcolor pc-ahead pc-at pc-towards pink pstamp pstamp-at pstamp-towards purple
Q / R
red
S
scale-color scale-pc setc, setcolor setc-at setc-of setc-towards setpc sky stamp stamp-at stamp-towards
T
turquoise
U / V
violet, purple
W
white
X / Y
yellow
Z