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 Painting

[screen shot]

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

WHAT IS IT?

This model demonstrates the use of groups of commands from version 2.0.0 of the palette extension. By moving their mouse the user changes the hue of background patches as well as the hue and brightness of nearby turtles. Hue, Saturation, and Brightness are referred to as "components" of the colors.

This model changes the hue, saturation, and brightness of colors by using these primitive groups:

component-of Primitives

The component of primitive group reports a particular component of an RGB/A or NL color. The model uses this group in the CODE tab to access sepcific components of PAINT-COLOR in the CODE. It uses these commands:

  • palette:hue-of color
  • palette:saturation-of color
  • palette:brightness-of color

with-component Primitives

The with component primitive group reports the color with the component changed to number while leaving the other components unchanged. This model uses the command to change the components of PAINT-COLOR in the CODE tab. It uses these commands:

  • color palette:with-hue number
  • color palette:with-saturation number
  • color palette:with-brightness number

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

Color Painting also makes use of NetLogo mouse primitives in the CODE tab to manage mouse input.

For more information on the palette commands, see the palette extension documentation.

(back to the NetLogo Models Library)