clr_rotate: Rotate the colors around the hue wheel

View source: R/rotate.R

clr_rotateR Documentation

Rotate the colors around the hue wheel

Description

Rotate the colors around the hue wheel

Usage

clr_rotate(col, degrees = 0)

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]⁠.

degrees

A number between 0 and 360, denoting the amount of degrees the colors should be rotated. Defaults to 0.

Details

The colors will be transformed to HCL color space (Hue-Chroma-Luminance) where the hue of the color will be rotated.

Value

A colors object of the same length as col.

Source

https://en.wikipedia.org/wiki/HCL_color_space

Examples

plot(clr_rotate(terrain.colors(10)))

plot(clr_rotate(terrain.colors(10), degrees = 90))

plot(clr_rotate(terrain.colors(10), degrees = 180))

plot(clr_rotate(rep("magenta", 11), degrees = seq(0, 360, length.out = 11)))

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