Colors (Printable)
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 setpc 15
will turn all of the patches
red, while setpc 19
will turn the patches a much lighter shade
of red. Type 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.
black color
[Observer, Turtle]
black reports the number of its particular hue in the color table.
Its reference number is 0.
blue color
[Observer, Turtle]
blue reports the number of its particular hue in the color table.
Its reference number is 105.
brown color
[Observer, Turtle]
brown reports the number of its particular hue in the color table.
Its reference number is 35.
color [Turtle]
Returns the color of the turtle.
color-at xcor ycor
[Observer, Turtle]
Reports the color of the turtle xcor
units in the x direction
and ycor
units in the y direction away from the caller .
color-of number
[Observer, Turtle]
Reports the color of the turtle with ID Number number
.
color-towards angle distance
[Observer, Turtle]
Reports the color of the turtle distance
away at an angle of angle
.
count-color color
[Observer, Turtle]
Returns the number of turtles that are the color color
.
count-pc color
[Observer, Turtle]
Returns the number of patches that are the color color
.
cyan color
[Observer, Turtle]
cyan reports the number of its particular hue in the color table.
Its reference number is 85.
gray, grey color
[Observer, Turtle]
gray reports the number of its particular hue in the color table.
Its reference number is 5.
green color
[Observer, Turtle]
green reports the number of its particular hue in the color table.
Its reference number is 55.
lime color
[Observer, Turtle]
lime reports the number of its particular hue in the color table.
Its reference number is 65.
magenta color
[Observer, Turtle]
magenta reports the number of its particular hue in the color table.
Its reference number is 125.
orange color
[Observer, Turtle]
orange reports the number of its particular hue in the color table.
Its reference number is 25.
pc-ahead [Turtle]
Reports the color of the patch one space ahead in the direction that the turtle
is facing.
Please see the color reference for more info on colors.
pc-at xcor ycor
[Observer, Turtle]
Reports the color of the patch xcor
units in the x direction
and ycor
units in the y direction away from the caller.
Please see the color reference for more info on colors.
pc-towards angle distance
[Observer, Turtle]
Reports the color of the patch distance
away at a relative heading
of angle
.
Please see the color reference for more info on colors.
pink color
[Observer, Turtle]
pink reports the number of its particular hue in the color table.
Its reference number is 135.
pstamp color
[Observer]
Allows patches to set the color of the turtle that is on it to color.
pstamp-at xcor ycor color
[Observer]
Allows patches to set the color of the turtle xcor
patches in
the x-direction and ycor
patches in the y-direction away to color.
pstamp-towards radius angle color
[Observer]
Allows patches to set the color of the turtle radius
units away
at an angle of angle
to color.
red color
[Observer, Turtle]
red reports the number of its particular hue in the color table.
Its reference number is 15.
scale-color color variable limit1 limit2
[Turtle]
Turtles set their color to a shade of color
based on their value
of variable
. limit1
and limit2
determine
the amount of gradation.
Example:
scale-color blue energy 0 20
Turtles turn one of twenty shades of blue. Turtles with lower energy turn darker
blue.
scale-color blue energy 20 0
Turtles turn one of twenty shades of blue. Turtles with lower energy turn lighter
blue.
scale-pc color variable limit1 limit2
[Observer]
Patches set their color to a shade of color
based on their value
of variable
. limit1
and limit2
determine
the amount of gradation.
Example:
scale-color green density 0 20
Patches turn one of twenty shades of green. Patches with lower density turn
darker green.
scale-color blue energy 20 0
Patches turn one of twenty shades of green. Patches with lower density turn
lighter green.
NOTE: This is a patch command. It must be called from within an ask-patches
or ask-patch-at
statement
setc, setcolor colorname (or colornumber)
[Turtle]
Turtles set their color to colorname (or color number)
.
setc-at xcor ycor number
[Observer, Turtle]
Sets the color of the turtle xcor
units in the x direction and
ycor
units in the y direction away from the caller to number
.
setc-of number1 number2
[Observer, Turtle]
Sets the color of the turtle with ID number1
to color number2
.
setc-towards angle distance number
[Observer, Turtle]
Sets the color of the turtle distance
away if the heading was
angle
to number
.
setpc, setpatchcolor color
[Observer, Turtle]
This command has two different uses. It can be run as a turtle command, in
which case it will set the color of the patches which are underneath turtles
to color
. It can also be run as a patch command, inside either
an ask-patches
or ask-patch-at
statement. In these
cases, the patches being asked will set their color to color
.
sky color
[Observer, Turtle]
sky reports the number of its particular hue in the color table.
Its reference number is 95.
stamp color
[Observer, Turtle]
Sets color of patch under turtle to color
stamp-at xcor ycor color
[Observer, Turtle]
Sets the color of the patch xcor
units in the x direction and
ycor
units in the y direction away from the caller to color
.
stamp-towards angle distance color
[Turtle]
Sets the color of the patch distance
away, if the heading were
angle
, to color
.
turquoise color
[Observer, Turtle]
turquoise reports the number of its particular hue in the color table.
Its reference number is 75.
violet, purple color
[Observer, Turtle]
violet
reports the number of its particular hue in the color table.
Its reference number is 115.
white color
[Observer, Turtle]
white reports the number of its particular hue in the color table.
Its reference number is 9.
yellow color
[Observer, Turtle]
yellow reports the number of its particular hue in the color table.
Its reference number is 45