Libraries‎ > ‎Library‎ > ‎Appearance‎ > ‎

Color

BehaviourComposer: ignore everything before this.
Begin micro-behaviour:
Begin description:
Change the color of this agent.
End description

Color

Begin NetLogo code:
substitute-text-area-for color-of-agent red        
set color color-of-agent
End NetLogo code

Variants

You can use any of these colors:

black, white, gray, red, orange, brown, yellow, green, lime, turquoise, cyan, sky, blue, violet, magenta, pink

More colors can be specified. One way is to specify a list of three numbers that indicate the intensity of the red, green, and blue components of the color. 0 is for none while 255 is for maximum. To pick a random colour replace the contents of the edit box with
(list random-integer-between 0 255  ; red
      random-integer-between 0 255  ; green
      random-integer-between 0 255) ; blue

You can also specify semi-transparent colors. For example, [64 64 255 127] defines a shade of blue that is half transparent (127/255 is roughly 0.5).

How this works

This sets the NetLogo primitive attribute color to the specified color.

Related micro-behaviours

History

Color was implemented by Ken Kahn.

BehaviourComposer: ignore everything after this.
Comments