[Rd] Wishlist: user-specified color names for palette() (PR#4836)

htang at hpl.hp.com htang at hpl.hp.com
Wed Oct 29 01:54:52 MET 2003


Full_Name: Hsiu-Khuern Tang
Version: 1.8.0
OS: GNU/Linux (Debian unstable)
Submission from: (NULL) (156.153.255.243)


Hi,

   I use palette(rgb(red=..., green=..., blue=..., names=mycolors)) to define my
own color palette.  After doing this, the names `mycolors' are not stored in
palette() anymore, so that palette() returns a mix of built-in color names and
RGB values.

Eg:
> palette()
 [1] "black"   "#EAA200" "#FF6633" "gray60"

I wish that palette() would return a _named vector_ like this:

> palette()
    black    orange    tomato      gray 
  "#000000" "#EAA200" "#FF6633"  "#999999" 

One application:

I want to specify colors by name, where the names returned by palette() are
searched first.  If there is a match, the corresponding RGB value is used;
otherwise the built-in R color is used.

Best,
Hsiu-Khuern Tang.



More information about the R-devel mailing list