lcars_pals: Palettes and palette generating functions based on LCARS...

View source: R/lcars.R

lcars_palsR Documentation

Palettes and palette generating functions based on LCARS colors

Description

Predefined and custom palettes based on LCARS colors.

Usage

lcars_pals()

lcars_pal(palette = "2357", reverse = FALSE)

lcars_colors_pal(palette, reverse = FALSE, ...)

Arguments

palette

character, name of a single predefined LCARS palette; or a vector of LCARS or other colors. See details.

reverse

logical, reverse color order.

...

additional arguments to pass to colorRampPalette().

Details

lcars_pal() returns a predefined, qualitative LCARS color palette. lcars_color_pal() returns a palette generator based on specific colors. lcars_pals() is a function that takes no arguments and returns a list of all predefined LCARS palettes.

Predefined palettes options for palette are "2357", "2369", "2375", "2379", "alt", "first_contact", "nemesis", "nx01", "23c", "29c", "red_alert" and "cardassian".

Custom palettes can also be constructed by passing a vector of colors to palette in lcars_color_pal(). This is useful for sequential and divergent palettes. This is essentially a wrapper around colorRampPalette() that understands LCARS color names. It accepts any color, allowing you to still use a color like "white" or "#FFFFFF" as the midpoint in a divergent palette for example. A special case is when you provide only a single color, e.g., lcars_color_pal("husk"); this is equivalent to lcars_color_pal(c("white", "husk")).

Value

a palette generating function that takes an argument, n, the number of colors.

Examples

# All predefined LCARS palettes
lcars_pals()
# predefined palette
lcars_pal("2357")
# custom palettes
lcars_colors_pal("rust")(8) # sequential
lcars_colors_pal(c("pale-canary", "rust"))(8)
lcars_colors_pal(c("pale-canary", "rust"))(4)
lcars_colors_pal(c("mariner", "white", "rust"))(9) # divergent

trekcolors documentation built on Sept. 13, 2024, 1:11 a.m.