\Header{palette}{Set or View the Graphics Palette}
\keyword{color}{palette}
\keyword{sysdata}{palette}
\begin{Description}\relax
View or manipulate the color palette which is used when a \code{col=}
has a numeric index.\end{Description}
\begin{Usage}
\begin{verbatim}
palette(value)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{value}] an optional character vector.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
If \code{value} has length 1, it is taken to be the name of
a built in color palette.  If \code{value} has length greater
than 1 it is assumed to contain a description of the colors
which are to make up the new palette (either by name or
by RGB levels).

If \code{value} is omitted or has length 0, no change is made
the current palette.

Currently, the only built-in palette is \code{"default"}.\end{Details}
\begin{Value}
The palette which \emph{was} in effect.  This is \code{\Link{invisible}}
unless the argument is omitted.\end{Value}
\begin{SeeAlso}\relax
\code{\Link{colors}} for the vector of built-in ``named'' colors;
\code{\Link{hsv}}, \code{\Link{gray}}, \code{\Link{rainbow}},
\code{\Link{terrain.colors}},\dots to construct colors;

\code{\Link{col2rgb}} for translating colors to RGB 3-vectors.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
palette()               # obtain the current palette
palette(rainbow(6))     # six color rainbow

(palette(gray(seq(0,.9,len=25)))) # gray scales; print old palette
matplot(outer(1:100,1:30), type='l', lty=1,lwd=2, col=1:30,
        main = "Gray Scales Palette",
        sub = "palette(gray(seq(0,.9,len=25)))")
palette("default")      # reset back to the default
\end{ExampleCode}
\end{Examples}

