powered by
These are a set of convenience functions for standard colour manipulation operations.
col_shift(col, amount = 10)col_lighter(col, amount = 10)col_darker(col, amount = 10)col_saturate(col, amount = 10)
col_lighter(col, amount = 10)
col_darker(col, amount = 10)
col_saturate(col, amount = 10)
A vector of colours.
A character vector of colours or a colour palette function.
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_shift()
col_lighter() and col_darker() take a number between -100 and 100 for adding (or subtracting) to the lightness channel in HSL space.
col_lighter()
col_darker()
col_saturate() takes a number between -100 and 100 for adding to the saturation channel in HSL space. Negative numbers desaturate the colour.
col_saturate()
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.
Other colour manipulation: alpha(), col2hcl(), col_mix(), muted()
alpha()
col2hcl()
col_mix()
muted()
col_shift("red", 180) # teal col_lighter("red", 50) # light red col_darker("red", 50) # dark red col_saturate("red", -50) # brick-red
Run the code above in your browser using DataLab