Learn R Programming

highlightHTML (version 0.2.5)

rgb2hex: Convert RGB to hex

Description

Enter a list of RGB color codes, or R colors, and get the appropriate hex color code.

Usage

rgb2hex(rgbcode = NULL, rcolor = NULL)

Arguments

rgbcode

List of rgb color codes, each list must be a vector of three objects representing the three components of rgb color code from 0 - 255. This can be a named list where the name represents the name of the color to be used.

rcolor

An unnamed list of R color names.

Examples

Run this code
# NOT RUN {
rgb2hex(rcolor = list("sienna2", "thistle1"))
rgb2hex(rcolor = list("sienna2", "thistle1"), rgbcode = list('orange' = c(238, 74, 24), 
'raw umber' = c(113, 75, 35)))
rgb2hex(rgbcode = list('orange' = c(238, 74, 24), 'raw umber' = c(113, 75, 35)))
# }

Run the code above in your browser using DataLab