Learn R Programming

evanverse (version 0.3.7)

get_palette: Get Palette: Load Color Palette from RDS

Description

Load a named palette from data/palettes.rds, returning a vector of HEX colors. Automatically checks for type mismatch and provides smart suggestions.

Usage

get_palette(
  name,
  type = c("sequential", "diverging", "qualitative"),
  n = NULL,
  palette_rds = system.file("extdata", "palettes.rds", package = "evanverse")
)

Value

Character vector of HEX color codes.

Arguments

name

Character. Name of the palette (e.g. "vividset").

type

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

n

Integer. Number of colors to return. If NULL, returns all colors. Default is NULL.

palette_rds

Character. Path to RDS file. Default uses system file in package.

Examples

Run this code
get_palette("vividset", type = "qualitative")
get_palette("softtrio", type = "qualitative", n = 2)
get_palette("blues", type = "sequential", n = 3)
get_palette("contrast_duo", type = "diverging")

Run the code above in your browser using DataLab