Skip to contents

These functions mix colour vectors with math functions.

Usage

# S3 method for class 'palettes_colour'
sum(..., na.rm = FALSE)

# S3 method for class 'palettes_colour'
cumsum(x)

Arguments

...

Colour vectors of class palettes_colour.

na.rm

Whether to include missing values. Either TRUE or FALSE.

x

An object of class palettes_colour.

Value

These functions return colour vectors of class palettes_colour:

  • sum() returns the sum of all the colours present in its arguments with additive colour mixing.

  • cumsum() returns a vector whose elements are the cumulative sums of the elements of the argument with additive colour mixing.

Examples

x <- pal_colour(c("red", "blue"))
sum(x)
#> <palettes_colour[1]>
#>  #FF00FF

x <- pal_colour(c("red", "blue", "yellow"))
cumsum(x)
#> <palettes_colour[3]>
#>  #FF0000
#>  #FF00FF
#>  #FFFFFF