
Last chance! 50% off unlimited learning
Sale ends in
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)
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)
Run the code above in your browser using DataLab