Create new color

setcolor index color
(setcolor index color opacity)

Set new color under specified index in the current color palette.

Color can be specified as a name, index in the current palette of colors or a list or array of color compunds: {r g b} or {r g b opacity}. The range of compoud values is from 0 (off) to 100 (full brightness), opacity values are from 0 (transparent) to 100 (opaque).

Example:

"n := 1000
repeat :n [
  "r := 100 * power repcount / :n 0.2
  "g := 100 * sin 90 * repcount / :n
  "b := 100 * cos 90 * repcount / :n
  setcolor repcount (array :r :g :b)
]

ht
pu setxy -250 0 pd
repeat 500 [
  pu setxy repcount-250 (-10) pd
  setpc 2*repcount fd 20
]

Output:
A strip of colors from the newly created palette.

See also:

Table of Content