contrast: Contrast Colour Selector

View source: R/palettes.R

contrastR Documentation

Contrast Colour Selector

Description

This function determines the appropriate contrast colour (either dark or light) for a given set of colours.

Usage

contrast(colour, dark = "black", light = "white")

Arguments

colour

A character vector of colour names or hex codes.

dark

A character string specifying the colour to use for dark contrast (default is "black").

light

A character string specifying the colour to use for light contrast (default is "white").

Value

A character vector of the same length as 'colour', containing the contrast colours (either 'dark' or 'light').

Examples

contrast(c("grey20", "grey80"))
contrast(c("#000000", "#FFFFFF"), dark = "navy", light = "yellow")

petrbouchal/ptrr documentation built on Oct. 10, 2024, 7:21 a.m.