Unique-Colors
Model was written in NetLogo 6.2.2
•
Viewed 205 times
•
Downloaded 27 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
patches-own [ new-pcolor ;; only for wheee demo ] to-report deep-color-1 [ value ] report ( red + 10 * (value mod 13) ;; base netlogo color ;; shift up or down + .5 * ( (int (value / 13 )) mod 2 * 2 - 1) ;; alternate normal -1, +1 ;; increase difference (gets brighter and darker) * (1 + int ( value / ( 2 * 13 ))) ) end to-report deep-color-2 [ value gamut shades ] ;; color from the wheel let hue (value mod gamut) / gamut * 360 ;; ring determines shift in brightness let ring ( int (value / gamut) ) mod shades ;; thickness of the slice of brightness ;; 160, not 200, so that brightest is not white and darkest is not black let thick 160 / shades ;; calculate it (180 for same reasons as 160, above (min bright is 20, max sat is 180)) let brightness 180 - ( ring * thick ) let saturation 100 if brightness > 100 [ set saturation (200 - brightness) set brightness 100 ] report HSB hue saturation (brightness) end to-report min-max [$value $min $max ] ( ifelse ( $value < $min ) [ report $min ] ( $value > $max ) [ report $max ] [ report $value ] ) end to adjust-world-view [ $width $height $pix-width-limit $pix-height-limit] let #max-height min-max $height 1 $pix-height-limit let #max-width min-max $width 1 $pix-width-limit let #p1 min-max ($pix-height-limit / #max-height) 1 40 let #p2 min-max ($pix-width-limit / #max-width) 1 40 let #p max list 1 min list #p1 #p2 set-patch-size #p resize-world 0 (#max-width - 1) 0 (#max-height - 1) set-patch-size #p end to test-deep-color-1 ca adjust-world-view 13 16 1000 500 foreach sort patches [ p -> ask p [ sprout 1 [ set color (deep-color-1 who) set pcolor color ] ] ] end to test-deep-color-2 ca adjust-world-view $gamut $shades 1000 500 foreach sort patches [ p -> ask p [ sprout 1 [ set color (deep-color-2 who $gamut $shades) set pcolor color ] ] ] end to startup test-deep-color-1 end ;; setup and go here are mainly for the modeling commons thumbnail generator to setup test-deep-color-1 end to go ask turtles [ rt (random 2 * 2 - 1) jump 1 / patch-size ] end
There are 4 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Unique-Colors.png | preview | Preview for 'Unique-Colors' | over 2 years ago, by James Steiner | Download |
This model does not have any ancestors.
This model does not have any descendants.