Predefined and custom palettes based on LCARS colors.

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().

Value

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

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")).

Examples

# All predefined LCARS palettes
lcars_pals()
#> $`2357`
#> [1] "#FFFF99" "#FFCC99" "#FFCC66" "#FF9933" "#664466" "#CC99CC" "#99CCFF"
#> [8] "#3366CC" "#006699"
#> 
#> $`2369`
#> [1] "#9999CC" "#9999FF" "#CC99CC" "#CC6699" "#CC6666" "#FF9966" "#FF9900"
#> [8] "#FFCC66"
#> 
#> $`2375`
#> [1] "#6688CC" "#4455BB" "#9977AA" "#774466" "#DD6644" "#AA5533" "#BB6622"
#> [8] "#EE9955"
#> 
#> $`2379`
#> [1] "#CCDDFF" "#5599FF" "#3366FF" "#0011EE" "#000088" "#BBAA55" "#BB4411"
#> [8] "#882211"
#> 
#> $alt
#>  [1] "#FF9C00" "#F7BD5A" "#FFCC99" "#FFFF33" "#FFFF9C" "#CD6363" "#CC99CC"
#>  [8] "#FF9E63" "#646DCC" "#9C9CFF" "#3399FF" "#99CCFF" "#FFFFCC" "#B1957A"
#> [15] "#ED884C" "#F5ED00" "#DDFFFF"
#> 
#> $first_contact
#> [1] "#C198B0" "#B46757" "#AE697D" "#97567B" "#C67825" "#B28452" "#C2B74B"
#> [8] "#BEBCDF"
#> 
#> $nemesis
#>  [1] "#0A45EE" "#3786FF" "#4BB0FF" "#87EEFF" "#46616E" "#D45F10" "#A35A1A"
#>  [8] "#A89B35" "#DFAF71" "#ACA98A"
#> 
#> $nx01
#> [1] "#BDEFFF" "#009CCE" "#DEFFB5" "#CD6363" "#E7FFFF" "#4D6184"
#> 
#> $`23c`
#> [1] "#0000FF" "#99CCFF" "#6666FF" "#99FF66" "#009900" "#FF6633" "#66CCFF"
#> 
#> $`29c`
#> [1] "#39C924" "#72E2E4" "#20788C" "#24BEE2" "#BC956E" "#D19FA2" "#805070"
#> [8] "#2062EE"
#> 
#> $red_alert
#> [1] "#F517C3" "#Bf2D42" "#A30E24" "#330512" "#D9D5B8" "#F1DFBF" "#4C4D47"
#> [8] "#9E9993"
#> 
#> $cardassian
#>  [1] "#B46356" "#944D40" "#7A4B42" "#CA480D" "#9B5928" "#C86C18" "#D78017"
#>  [8] "#F9AB3C" "#FFE705" "#FFF7A3" "#E2ED50" "#2F7270" "#66FFFF" "#3C999C"
#> [15] "#8BEAFF" "#13A4EB" "#2E7BC5" "#A1B3E2" "#BFCAFE" "#8B799C" "#524559"
#> 
# predefined palette
lcars_pal("2357")
#> [1] "#FFFF99" "#FFCC99" "#FFCC66" "#FF9933" "#664466" "#CC99CC" "#99CCFF"
#> [8] "#3366CC" "#006699"
# custom palettes
lcars_colors_pal("rust")(8) # sequential
#> [1] "#FFFFFF" "#F5E4DD" "#EBC9BB" "#E1AE99" "#D89477" "#CE7955" "#C45E33"
#> [8] "#BB4411"
lcars_colors_pal(c("pale-canary", "rust"))(8)
#> [1] "#FFFF99" "#F5E485" "#EBC972" "#E1AE5E" "#D8944B" "#CE7937" "#C45E24"
#> [8] "#BB4411"
lcars_colors_pal(c("pale-canary", "rust"))(4)
#> [1] "#FFFF99" "#E8C06B" "#D1823E" "#BB4411"
lcars_colors_pal(c("mariner", "white", "rust"))(9) # divergent
#> [1] "#3366CC" "#668CD8" "#99B2E5" "#CCD8F2" "#FFFFFF" "#EED0C3" "#DDA188"
#> [8] "#CB724C" "#BB4411"