Closed trinker closed 7 years ago
col2hex(c("red","yellow","lightgrey"))
x <- c('black', 'red')
col2hex <- function(x){
stopifnot(all(x %in% grDevices::colors()))
m <- col2rgb(x, alpha = FALSE)
rgb(m[1,], m[2,], m[3,], maxColorValue=255)
}
hilighter_palette <- col2hex(c('orange', 'gray70', 'yellow', 'pink', 'cyan', 'hotpink', 'chartreuse', 'lightgoldenrod3', 'mediumorchid1', 'burlywood1'))
view_hex_pallette <- function(x) {
cols <- rev(x)
ggplot2::ggplot(data.frame(x = seq_along(x), y = 1), ggplot2::aes(x=cols, y=y, fill=cols)) +
ggplot2::geom_bar(stat = 'identity') +
ggplot2::scale_fill_manual(values = cols) +
ggplot2::coord_flip() +
ggplot2::theme_minimal() +
ggplot2::scale_y_continuous(expand = c(0, 0), limits = c(0, 1)) +
ggplot2::theme(
axis.text.x = ggplot2::element_blank(),
axis.ticks = ggplot2::element_blank(),
panel.grid = ggplot2::element_blank(),
legend.position='none'
) +
ggplot2::labs(y = NULL, x=NULL)
}
view_hex_pallette(hilighter_palette)
pallette of 10 hilighter colors