cr_choose_color: Choose a High-Contrast Color for a Given Color

Description Usage Arguments Value Examples

View source: R/contrast.R

Description

Given a user-supplied color, what's a good color to pair it with for maximum contrast? Compares provided color against all named R colors, as per colors. Contrast calculated as per cr_get_ratio.

Usage

1
cr_choose_color(col, n = 1, ex_bw = FALSE)

Arguments

col

A character value representing a color. Can be a six-digit hex value preceded by '#', or a named color from

n

Number of named colors to return. Color with highest contrast is returned first.

ex_bw

Exclude black and variants of white and gray variants?

Value

A character value that's a named R color.

Examples

1
cr_choose_color("lightyellow")

matt-dray/coloratio documentation built on June 2, 2021, 6:42 a.m.