Skip to contents

Adds degrees to each colour's HSL hue, wrapping around the colour wheel (%% 360). Generalizes the fixed hue offsets palette_harmony() uses internally into a plain, arbitrary-angle operation on an existing colour vector.

Usage

color_rotate_hue(color, degrees = 30)

Arguments

color

A character vector of colours.

degrees

A numeric vector (degrees), recycled against color: the hue rotation, positive or negative, of any magnitude.

Value

A character vector of hex colour strings, the same length as the longer of color/degrees.

Examples

color_rotate_hue("tomato", degrees = 180)
#> [1] "#47E3FF"
color_rotate_hue(palette_manual(index = 1), degrees = c(0, 30, 60, 90, 120))
#> [1] "#33658A" "#8692D8" "#3F2F58" "#2DF649" "#19F264"
draw(effect_swatch(color = color_rotate_hue("tomato", degrees = seq(0, 300, 60))))