clr_negate: Negate colors in RGB space

View source: R/negate.R

clr_negateR Documentation

Negate colors in RGB space

Description

Negate colors in RGB space

Usage

clr_negate(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

The negation of color is happening in the red-green-blue colorspace RGB. This means if we take the specification for orange which is rgb(255, 165, 0), then we negate by taking the opposite number on the scale from 0 to 255, leaving us with rgb(0, 90, 255), which is a shade of blue.

Value

A colors object of the same length as col.

Examples

clr_negate("orange")

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

terr
clr_negate(terr)

plot(terr)
plot(clr_negate(terr))

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