This creates a list of colour vectors.
Arguments
- ...
For
pal_palette()
: A named list of character vectors of any of the three kinds of R colour specifications, or a named list of colour vectors of classpalettes_colour
.
- x
For
as_palette()
: An object to be coerced.For
is_palette()
: An object to test.
Details
Colours can be specified using either:
Hexadecimal strings of the form
"#RRGGBB"
or"#RRGGBBAA"
Colour names from
grDevices::colors()
Positive integers
i
that index intogrDevices::palette()
[i]
Examples
pal_palette(
Egypt = c("#DD5129", "#0F7BA2", "#43B284", "#FAB255"),
Java = c("#663171", "#CF3A36", "#EA7428", "#E2998A", "#0C7156")
)
#> <palettes_palette[2]>
#> $Egypt
#> <palettes_colour[4]>
#> • #DD5129
#> • #0F7BA2
#> • #43B284
#> • #FAB255
#>
#> $Java
#> <palettes_colour[5]>
#> • #663171
#> • #CF3A36
#> • #EA7428
#> • #E2998A
#> • #0C7156
#>
x <- list(
Egypt = c("#DD5129", "#0F7BA2", "#43B284", "#FAB255"),
Java = c("#663171", "#CF3A36", "#EA7428", "#E2998A", "#0C7156")
)
as_palette(x)
#> <palettes_palette[2]>
#> $Egypt
#> <palettes_colour[4]>
#> • #DD5129
#> • #0F7BA2
#> • #43B284
#> • #FAB255
#>
#> $Java
#> <palettes_colour[5]>
#> • #663171
#> • #CF3A36
#> • #EA7428
#> • #E2998A
#> • #0C7156
#>