trinker / textplot

Plotting for text data
18 stars 1 forks source link

convert named colors to hex in hilight #7

Closed trinker closed 7 years ago

trinker commented 7 years ago
col2hex <- function(x){
    stopifnot(all(x %in% grDevices::colors()))
    m <- col2rgb(x, alpha = FALSE)
    rgb(m[1,], m[2,], m[3,], maxColorValue=255)
}

col2hex(c('purple', 'black', 'red'))