R/farv_show.R

Defines functions farv_show

Documented in farv_show

#' Show colors based on a vector of HEX colors.
#'
#' @param x a vector of HEX colors.
#'
#' @return plot
#' @export
#' @importFrom rlang .data
#' @examples
#' farv_show(c("#d95f02", "#7570b3"))
farv_show <- function(x) {
  df <- data.frame(id = seq_along(x))
  df %>%
  ggplot2::ggplot() +
    ggplot2::geom_tile(ggplot2::aes(.data$id, 1, fill = x)) +
    ggplot2::scale_fill_identity()
}
davidbaniadam/farver documentation built on July 12, 2019, 11:51 p.m.