Title: | Star Trek Color Palettes |
---|---|
Description: | Provides a dataset of predefined color palettes based on the Star Trek science fiction series, associated color palette functions, and additional functions for generating customized palettes that are on theme. The package also offers functions for applying the palettes to plots made using the 'ggplot2' package. |
Authors: | Matthew Leonawicz [aut, cre] |
Maintainer: | Matthew Leonawicz <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0 |
Built: | 2024-11-10 06:01:26 UTC |
Source: | https://github.com/leonawicz/trekcolors |
Obtain hex colors from standard LCARS color names.
lcars_colors(...) lcars_2357(...) lcars_2369(...) lcars_2375(...) lcars_2379(...)
lcars_colors(...) lcars_2357(...) lcars_2369(...) lcars_2375(...) lcars_2379(...)
... |
character, LCARS color names. |
These functions return the hex colors for LCARS color names. If no argument
is provided, the functions return their respective LCARS color set.
These functions correspond to LCARS color palettes that contain named colors.
Other predefined LCARS color palettes are available but do not have names for
each color. You can see all LCARS palettes with lcars_pals()
.
lcars_colors() lcars_2357() lcars_colors("rust", "danub")
lcars_colors() lcars_2357() lcars_colors("rust", "danub")
Predefined and custom palettes based on LCARS colors.
lcars_pals() lcars_pal(palette = "2357", reverse = FALSE) lcars_colors_pal(palette, reverse = FALSE, ...)
lcars_pals() lcars_pal(palette = "2357", reverse = FALSE) lcars_colors_pal(palette, reverse = FALSE, ...)
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 |
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"))
.
a palette generating function that takes an argument, n
, the number
of colors.
# 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
# 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
Scale functions used with ggplot2.
scale_color_lcars(palette = "2357", discrete = TRUE, reverse = FALSE, ...) scale_color_lcars1( color = "atomic-tangerine", discrete = TRUE, reverse = FALSE, dark = FALSE, ... ) scale_color_lcars2( low = "atomic-tangerine", high = "near-blue", discrete = TRUE, reverse = FALSE, dark = FALSE, divergent = FALSE, ... ) scale_fill_lcars(palette = "2357", discrete = TRUE, reverse = FALSE, ...) scale_fill_lcars1( color = "atomic-tangerine", discrete = TRUE, reverse = FALSE, dark = FALSE, ... ) scale_fill_lcars2( low = "atomic-tangerine", high = "near-blue", discrete = TRUE, reverse = FALSE, dark = FALSE, divergent = FALSE, ... )
scale_color_lcars(palette = "2357", discrete = TRUE, reverse = FALSE, ...) scale_color_lcars1( color = "atomic-tangerine", discrete = TRUE, reverse = FALSE, dark = FALSE, ... ) scale_color_lcars2( low = "atomic-tangerine", high = "near-blue", discrete = TRUE, reverse = FALSE, dark = FALSE, divergent = FALSE, ... ) scale_fill_lcars(palette = "2357", discrete = TRUE, reverse = FALSE, ...) scale_fill_lcars1( color = "atomic-tangerine", discrete = TRUE, reverse = FALSE, dark = FALSE, ... ) scale_fill_lcars2( low = "atomic-tangerine", high = "near-blue", discrete = TRUE, reverse = FALSE, dark = FALSE, divergent = FALSE, ... )
palette |
character, name of palette in |
discrete |
logical, discrete or continuous palette. |
reverse |
logical, reverse color order. |
... |
additional arguments passed to |
color |
character, LCARS color name for sequential palette. |
dark |
logical, use black instead of white for the base color in sequential palette or midpoint in divergent palette. |
low |
character, LCARS color name. |
high |
character, LCARS color name. |
divergent |
logical, use a divergent palette instead of two-color sequential palette. |
library(ggplot2) p <- ggplot(diamonds, aes(carat, stat(count), fill = cut)) + geom_density(position = "fill") p + scale_fill_lcars("2357") p + scale_fill_lcars1("atomic-tangerine", dark = TRUE) p + scale_fill_lcars2("pale-canary", "danub")
library(ggplot2) p <- ggplot(diamonds, aes(carat, stat(count), fill = cut)) + geom_density(position = "fill") p + scale_fill_lcars("2357") p + scale_fill_lcars1("atomic-tangerine", dark = TRUE) p + scale_fill_lcars2("pale-canary", "danub")
Scale functions used with ggplot2.
scale_color_trek(palette = "starfleet", discrete = TRUE, reverse = FALSE, ...) scale_fill_trek(palette = "starfleet", discrete = TRUE, reverse = FALSE, ...)
scale_color_trek(palette = "starfleet", discrete = TRUE, reverse = FALSE, ...) scale_fill_trek(palette = "starfleet", discrete = TRUE, reverse = FALSE, ...)
palette |
character, name of Star Trek palette. See |
discrete |
logical, discrete or continuous palette. |
reverse |
logical, reverse color order. |
... |
additional arguments passed to |
Most palettes should be used as qualitative palettes. See trekpals
to see
how many colors are in each predefined palette. Use view_trek_pals()
to
plot all palettes to see which may work best for your purposes.
library(ggplot2) d <- diamonds[diamonds$cut >= "Very Good", ] ggplot(d, aes(carat, stat(count), fill = cut)) + geom_density(position = "fill") + scale_fill_trek("starfleet")
library(ggplot2) d <- diamonds[diamonds$cut >= "Very Good", ] ggplot(d, aes(carat, stat(count), fill = cut)) + geom_density(position = "fill") + scale_fill_trek("starfleet")
Return a predefined Star Trek color palette from the trekpals
dataset.
trek_pal(palette, reverse = FALSE) view_trek_pals(palette)
trek_pal(palette, reverse = FALSE) view_trek_pals(palette)
palette |
character, name of predefined palette. If missing, return all available palette names. |
reverse |
logical, reverse color order. |
Many of the palettes are qualitative, and not necessarily evenly spaced in terms of hue, saturation or brightness. This is because many palettes come from logos, symbols, insignia and other simple representations. However, several palettes have specifically been constructed as sequential or divergent if it made sense to do so based on the dominant colors present. Additional special functions exist for the subset of LCARS palettes.
character vector of hex colors or palette names
trek_pal("lcars_2357") # leave palette blank to list available names: trek_pal() # to view all palettes view_trek_pals()
trek_pal("lcars_2357") # leave palette blank to list available names: trek_pal() # to view all palettes view_trek_pals()
Provides a dataset of predefined color palettes based on the Star Trek science fiction series, associated color palette functions, and additional functions for generating customized palettes that are on theme. The package also offers functions for applying the palettes to plots made using the 'ggplot2' package.
Maintainer: Matthew Leonawicz [email protected] (ORCID)
Useful links:
Report bugs at https://github.com/leonawicz/trekcolors/issues
A named list of 35 Star Trek color palettes.
trekpals
trekpals
A named list.