rgb.to.hex {plotrix} | R Documentation |
rgb.to.hex
converts the first three values in rgb
to a six
digit hexadecimal string preceded by a hash character. If all three values
are between 0 and 1, all are scaled up to a range of 0-255 unless
scale.up
is FALSE.
rgb.to.hex(rgb,scale.up=TRUE)
rgb |
A numeric vector of length at least 3 representing the relative red, green and blue values. Each value must be between 0 and 255. |
scale.up |
A logical value indicating whether to scale up when all values are between 0 and 1. |
hexadecimal color
gradient.rect
# a light purple color in a 0-1 format rgb.to.hex(c(0.9,0.5,0.9)) # supressing the scaling gives almost pure black rgb.to.hex(c(0.9,0.5,0.9),FALSE)