Skip to contents

Retrieve a named palette by name and type, returning a vector of HEX colors. Automatically checks for type mismatch and provides smart suggestions.

Usage

get_palette(name, type = NULL, n = NULL)

Arguments

name

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

type

Character. One of "sequential", "diverging", "qualitative". If NULL, type is auto-detected.

n

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

Value

Character vector of HEX color codes.

Examples

get_palette("qual_vivid", type = "qualitative")
#> [1] "#E64B35" "#4DBBD5" "#00A087" "#3C5488" "#F39B7F" "#8491B4" "#91D1C2"
#> [8] "#DC0000" "#7E6148"
get_palette("qual_softtrio", type = "qualitative", n = 2)
#> [1] "#E64B35B2" "#00A087B2"
get_palette("seq_blues", type = "sequential", n = 3)
#> [1] "#deebf7" "#9ecae1" "#3182bd"
get_palette("div_contrast", type = "diverging")
#> [1] "#C64328" "#56BBA5"