HSB and RGB Example
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This is a simple example of NetLogo colors versus RGB colors using approximate-rgb
and approximate-hsb
, and extract-rgb
.
To use it, simply press GO. The top three sliders specify a color in the HSB spectrum which is displayed in the top half of the world, while the bottom three sliders specify a color in the RGB spectrum which is displayed in the bottom half of the world.
The left side of the world is the approximate NetLogo color equivalent to the specified color, the right half of the world is the actual RGB color. The two monitors show the value of the NetLogo color, in the range of 0 to 140, that is actually displayed.
NETLOGO FEATURES
The origin patch (0,0) is in the corner rather than the center, so the dimensions of the patch grid can be even, so the grid can be divided into four equal quadrants.
Comments and Questions
globals [ HSB-as-RGB HSB-color RGB-color ] to go set HSB-as-RGB hsb hue saturation brightness set HSB-color approximate-hsb hue saturation brightness ask quadrant -1 1 [ set pcolor HSB-as-RGB ] ask quadrant 1 1 [ set pcolor HSB-color ] set RGB-color approximate-rgb rgb-red rgb-green rgb-blue ask quadrant -1 -1 [ set pcolor (list rgb-red rgb-green rgb-blue) ] ask quadrant 1 -1 [ set pcolor RGB-color ] end to-report quadrant [x y] ;; inputs are 1 or -1 report patches with [patch-quadrant = list x y] end to-report patch-quadrant ;; patch procedure report list ifelse-value (pxcor < world-width / 2) [-1] [1] ifelse-value (pycor < world-width / 2) [-1] [1] end ; Public Domain: ; To the extent possible under law, Uri Wilensky has waived all ; copyright and related or neighboring rights to this model.
There are 10 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
HSB and RGB Example.png | preview | Preview for 'HSB and RGB Example' | over 12 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.