File: hex.Rd

package info (click to toggle)
r-cran-colorspace 1.4-0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,588 kB
  • sloc: ansic: 1,206; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 1,376 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/colorspace.R
\name{hex}
\alias{hex}
\title{Convert Colors to Hexadecimal Strings}
\usage{
hex(from, gamma = NULL, fixup = FALSE)
}
\arguments{
\item{from}{The color object to be converted.}

\item{gamma}{Deprecated.}

\item{fixup}{Should the color be corrected to a valid RGB value before
correction.  The default is to convert out-of-gamut colors to the string
\code{"NA"}.}
}
\value{
A vector of character strings.
}
\description{
This functions converts \code{\link{color-class}} objects into hexadecimal strings.
}
\details{
The color objects are first converted to sRGB color objects.  They are then
multiplied by 255 and rounded to obtain an integer value.  These values are
then converted to hexadecimal strings of the form \code{"#RRGGBB"} and
suitable for use as color descriptions for R graphics.  Out of gamut values
are either corrected to valid RGB values by translating the the individual
primary values so that they lie between 0 and 255.
}
\examples{
hsv <- HSV(seq(0, 360, length = 7)[-7], 1, 1)
hsv
hex(hsv)
barplot(rep(1,6), col = hex(hsv))
}
\seealso{
\code{\link{hex2RGB}}, \code{\link{RGB}}, \code{\link{sRGB}},
\code{\link{HSV}}, \code{\link{XYZ}}, \code{\link{LAB}},
\code{\link{polarLAB}}, \code{\link{LUV}}, \code{\link{polarLUV}}.
}
\author{
Ross Ihaka
}
\keyword{color}