NetLogo banner

Home
Download
Help
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo Models Library:
Code Examples/Extensions Examples/palette

(back to the library)

Color Reveal

[screen shot]

Note: If you download the NetLogo application, every model in the Models Library is included.

WHAT IS IT?

Color Reveal demonstrates commands from version 2.0.0 of the palette extension. Turtles move around the space and raise the saturation or brightness of patches they cross over, revealing a colorful layout. As they move, they lose energy and fade away. This model uses primitives that modify saturation, brightness, and transparency (a number from 0 to 100 that measures the transparency of a color).

It uses a few primitive groups from the palette extension:

palette:scheme-colors

This primitive reports a color scheme from Color Brewer, an online color suggestion tool. The model uses a color scheme for patches and turtles.

set-component Primitives

The set component primitive group directly changes the component of a color without the list manipulations (which in the previous versions of the extension were required). In this example, we use the primitives to set the components of an agent's color. The model uses these commands to change the color of turtles and patches:

  • palette:set-hue number
  • palette:set-saturation number
  • palette:set-brightness number
  • palette:set-transparency number

In the GO procedure, the model creates new turtles to keep the turtle count at NUM-TURTLES. When turtles move, they change the brightness or saturation of the patch beneath their path.

For more information, see the palette extension documentation.

(back to the NetLogo Models Library)