canva_pal: Canva.com color palettes

View source: R/canva.R

canva_palR Documentation

Canva.com color palettes

Description

150+ color palettes from canva.com. See canva_palettes().

Usage

canva_pal(palette = "Fresh and bright")

Arguments

palette

Palette name. See the names of canva_palettes() for valid names.

Value

A function that takes a single value, the number of colors to use.

Examples

require("ggplot2")
require("tibble")
if (require("purrr") && require("scales") && require("dplyr")) {
  canva_df <- map2_df(
    canva_palettes,
    names(canva_palettes),
    ~ tibble(
      colors = .x,
      .id = seq_along(colors),
      palette = .y
    )
  )
  ggplot(canva_df, aes(
    y = palette,
    x = .id,
    fill = colors
  )) +
    geom_raster() +
    scale_fill_identity(guide = FALSE) +
    theme_minimal() +
    theme(
      panel.grid = element_blank(),
      axis.text.x = element_blank()
    ) +
    labs(x = "", y = "")

  show_col(canva_pal("Fresh and bright")(4))
  show_col(canva_pal("Cool blues")(4))
  show_col(canva_pal("Modern and crisp")(4))
}

jrnold/ggthemes documentation built on Feb. 17, 2024, 7:30 a.m.