Skip to contents

Save a named color palette (sequential, diverging, or qualitative) to a JSON file. Used for palette sharing, reuse, and future compilation.

Usage

create_palette(
  name,
  type = c("sequential", "diverging", "qualitative"),
  colors,
  color_dir = "inst/extdata/palettes",
  log = TRUE
)

Arguments

name

Character. Palette name (e.g., "Blues").

type

Character. One of "sequential", "diverging", or "qualitative".

colors

Character vector of HEX color values (e.g., "#E64B35" or "#E64B35B2").

color_dir

Root folder to store palettes (default: "inst/extdata/palettes").

log

Logical. Whether to log palette creation to a temporary log file.

Value

(Invisibly) A list with path and info.

Examples

# Basic usage (commented to avoid file operations):
# create_palette("blues", "sequential", c("#deebf7", "#9ecae1", "#3182bd"))
# create_palette("vividset", "qualitative", c("#E64B35", "#4DBBD5", "#00A087"))