NetLogo banner

Home
Download
Help
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
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 Bubbles

[screen shot]

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

WHAT IS IT?

Color Bubbles demonstrates the capabilities of palette 2.0.0 by offering a visually appealing demonstration of hue, saturation, brightness, and alpha (a value between 0 and 255 that represents the opacity of the agent, 255 is solid color, 0 is invisible). Users can use the palette commands to play with the color of the circles and background.

This example makes use of two groups of palette primitives:

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-alpha number

component Primitives

The component primitives report a component of an agent's color. This model uses the command to increase or decrease a component by a fixed amount. The primitives used in this model which are found in buttons under the "Change Turtles" note on the right hand side of the VIEW:

  • palette:saturation
  • palette:brightness

In the UPDATE-COLORS procedure, we use four set component primitives group to change the colors of patches and turtles. The change turtle buttons increase or decrease the named component with component primitives, as does the ALPHA slider.

For more information, see the documentation for the palette extension.

(back to the NetLogo Models Library)