Skip to contents

Inverts each colour's RGB channels (1 - channel), the classic "photo negative" transform. Unlike color_rotate_hue(degrees = 180), which keeps HSL saturation/lightness fixed and only flips hue, RGB inversion also flips lightness (e.g. white inverts to black, not to another light colour).

Usage

color_invert(color)

Arguments

color

A character vector of colours.

Value

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

Examples

color_invert("white")
#> [1] "#000000"
color_invert(palette_manual(index = 1))
#> [1] "#CC9A75" "#794427" "#D0B7A7" "#0951D2" "#0D9BE6"
draw(effect_swatch(color = color_invert(palette_manual(index = 1))))