Built on the col2hex() function from the gplot package by Tal Galili with added error handling

col2hex2(cname)

Arguments

cname

character string name of a built-in r color

Value

character string with hex code

Examples

col2hex("firebrick4")
#> Error in col2hex("firebrick4"): could not find function "col2hex"