complement: Compute the complement color

View source: R/compute_complement.R

complementR Documentation

Compute the complement color

Description

Compute the complement color

Usage

complement(x, mode = "ryb")

Arguments

x

vector of colors specified as hex strings or named R colors.

mode

color mode to use, either "ryb" which yields the natural, paint-like complement, or "rgb"

Value

A vector of colors specified as hex codes

Examples

# paint-like complements
a <- c("red", "yellow", "blue")
b <- c("green", "purple", "orange")
w <- c("white", "white", "white")
show_col(a, complement(a), b, w, b, complement(b), a)

# scren-like complements
show_col(a, complement(a, mode="ryb"))
show_col(a, complement(a, mode="rgb"))
x <- c("red", "green", "blue", "cyan", "magenta", "yellow")
show_col(x, complement(x, mode="rgb"))

jiho/chroma documentation built on Nov. 26, 2022, 2:39 a.m.