color: Turn vector of colors to 'color' vector

View source: R/color.R

colorR Documentation

Turn vector of colors to color vector

Description

Turn vector of colors to color vector

Usage

color(col)

colour(col)

Arguments

col

A colors object (see color()) or a vector of any of the three kinds of R color specifications, i.e., either a color name (as listed by grDevices::colors()), a hexadecimal string (see col2rgb()), or a positive integer i meaning grDevices::palette()⁠[i]⁠.

Details

Alpha values will be automatically added to hexcodes. If no alpha value is present in col, it will default to no alpha (FF).

Value

A colors object of the same length as col. Returns hex 8 digits form "#rrggbbaa". See Details.

Examples

terrain_10 <- color(terrain.colors(10))

terrain_10[1:4]

plot(terrain_10)

plot(terrain_10, labels = TRUE)

grey_10 <- color(gray.colors(10, start = 0, end = 1))

grey_10

plot(grey_10, labels = TRUE)

EmilHvitfeldt/prismatic documentation built on Nov. 23, 2024, 10:41 a.m.