R-alpha: Colors

Ross Ihaka ihaka@stat.auckland.ac.nz
Thu, 7 Aug 1997 16:42:21 +1200 (NZST)

Here is a proposal:

At present when you specify a color with an integer it is taken as an
index into a fixed table of 8 colors.

	1=red, 2=green, 3=blue, 4=cyan,
	5=magenta, 6=yellow, 7=white, 8=black

[At least this is the intention, there may be bugs in the
implementation].  Since I am looking at this anyway (to see if I can
see the bug that Martin and Kurt have mentioned) I thought I might
make a larger change.

I would like to make the color table, user definable.  To do this
there needs to be a function

	palette(name, value)

where "name" could be used to select one on a number of standard
built-in palettes (e.g. "default", "heat", "terrain", "pastels" etc)
and (if name was not specified, "value" could be a character vector of
color specifications (of length less than or equal to 256?).  Either
names (e.g. "red", "lightblue" ...)  or by rgb values (e.g "#FF00FF")
could be used in the vector.

The function palette would return the previous palette, and
could be used to obtain the current settings without a change.

After a call to palette integer col= specification would provide
indexes into this table.

col=0 could be used to indicate the current background color.

The "default" palette would have 1=black.

Any comments?
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch