pal_colour: Colour vectors

View source: R/colour.R

pal_colourR Documentation

Colour vectors

Description

This creates a character vector that represents colours so when it is printed, colours will be formatted as hexadecimal strings.

Usage

pal_colour(x = character())

is_colour(x)

as_colour(x)

## Default S3 method:
as_colour(x)

## S3 method for class 'palettes_palette'
as_colour(x)

Arguments

x
  • For pal_colour(): A character vector of any of the three kinds of R colour specifications.

  • For as_colour(): An object to be coerced.

  • For is_colour(): 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 into grDevices::palette()⁠[i]⁠

Value

An S3 vector of class palettes_colour.

See Also

pal_palette()

Examples

pal_colour(c("darkred", "#0F7BA2"))

is_colour("darkred")
is_colour(pal_colour("darkred"))

as_colour("#0F7BA2")

palettes documentation built on Sept. 11, 2024, 5:57 p.m.