colour_manip: Colour manipulation

colour_manipR Documentation

Colour manipulation

Description

These are a set of convenience functions for standard colour manipulation operations.

Usage

col_shift(col, amount = 10)

col_lighter(col, amount = 10)

col_darker(col, amount = 10)

col_saturate(col, amount = 10)

Arguments

col

A character vector of colours.

amount

A numeric vector giving the change. The interpretation depends on the function:

  • col_shift() takes a number between -360 and 360 for shifting hues in HCL space.

  • col_lighter() and col_darker() take a number between -100 and 100 for adding (or subtracting) to the lightness channel in HSL space.

  • col_saturate() takes a number between -100 and 100 for adding to the saturation channel in HSL space. Negative numbers desaturate the colour.

Details

col_shift() considers the hue channel to be periodic, so adding 180 to a colour with hue 270 will result in a colour with hue 90.

Value

A vector of colours.

See Also

Other colour manipulation: alpha(), col2hcl(), col_mix(), muted()

Examples

col_shift("red", 180) # teal
col_lighter("red", 50) # light red
col_darker("red", 50) # dark red
col_saturate("red", -50) # brick-red

hadley/scales documentation built on Sept. 24, 2024, 4:29 a.m.