Skip to contents

Returns a palette as a function(n), the form ggplot2 scales and theme palettes expect. Asking for the number of anchor colors returns the anchors themselves; any other n follows the palette's rule.

Usage

maison_pal(palette = "categorical", reverse = FALSE)

Arguments

palette

A palette name from the table above.

reverse

TRUE flips the order of the colors.

Value

A function that takes n and returns n hex codes.

Details

PaletteColorsOther lengths
"categorical"plum, honey, cobalt, leaf, rust, berry, mauve, charcoalthe first n, in order; more than eight is an error
"categorical_dark"honey, lilac, leaf, rust, light blue, mauvethe first n; more than six is an error
"seq_purple", "seq_neutral", "seq_gray", "seq_red", "seq_honey", "seq_green", "seq_rust", "seq_cobalt"seven steps from warm_white to the named colorramped
"diverging"charcoal, plum, warm_white, redramped
"diverging_green"plum to green, five stepsramped
"quiet"muted purple to muted sage around a light gray, five stepsramped
"quiet_purple", "quiet_sage"five steps, dark to lightramped
"likert"rust, rust_light, sand, green_light, greenramped; an odd n centers on sand

Categorical palettes

The categorical palettes never ramp: unordered groups need colors that are clearly different, so one group too many is an error, not an in-between shade. Red is not a categorical color. It is reserved for emphasis; see maison_highlight().

"categorical_dark" is for charcoal backgrounds, and theme_maison(dark = TRUE) uses it. Every color has at least 3:1 contrast against charcoal, and they run from the highest contrast to the lowest. Four are categorical colors: honey, leaf, rust and mauve. Plum and charcoal vanish on charcoal, and cobalt and berry fall just short, so blue and purple come from lighter steps of maison's own ramps: #5884AC from "seq_cobalt" and lilac #A99AAF from "quiet_purple".

Sequential ramps

Seven of the seq_* ramps are hand-tuned. "seq_cobalt" is generated to match their step spacing.

Quiet palettes

The quiet family is for scales with no good or bad direction, such as "prefer A" against "prefer B".

See also

scale_fill_maison_d() and friends for ready-made scales.

Examples

maison_pal("categorical")(3)
#> [1] "#463752" "#DBA940" "#246A9B"
maison_pal("likert")(7)
#> [1] "#D4663A" "#DC8463" "#E4A987" "#EBD4A6" "#A1B893" "#679173" "#3C6046"
maison_pal("seq_cobalt")(7)
#> [1] "#FAF9F7" "#EBEEF0" "#D0D9E3" "#ABBDD2" "#84A0BF" "#5884AC" "#246A9B"
maison_pal("quiet", reverse = TRUE)(5)
#> [1] "#465351" "#9AAFA9" "#DADADA" "#A99AAF" "#514653"