palette:scale-gradient

scale-gradient rgb-color-list number range1 range2

Reports an rgb color proportional to number using a gradient generated with rgb-color-list. An rgb-color-list consist of a list contaning rgb list with three values between 0 and 255: [[r1 g1 b1] [r2 g2 b2] [r3 g3 b3] ...]

If range1 is less than range2, the color will be directly mapped to gradient colors. While, if range2 is less than range1, the color gradient is inverted.

If number is less than range1, then the first color of is rgb-color-list is chosen.

If number is grater than range2, then the last color of is rgb-color-list is chosen.

ask patches 
[
  set pcolor palette:scale-gradient [[255 0 0] [0 0 255]] pxcor min-pxcor max-pxcor
]


;; colors each patch with a color proportional to the gradient  

Take me to the full NetLogo Dictionary