Learn R Programming

Seurat (version 5.0.3)

BGTextColor: Determine text color based on background color

Description

Determine text color based on background color

Usage

BGTextColor(
  background,
  threshold = 186,
  w3c = FALSE,
  dark = "black",
  light = "white"
)

Value

A named vector of either dark or light, depending on background; names of vector are background

Arguments

background

A vector of background colors; supports R color names and hexadecimal codes

threshold

Intensity threshold for light/dark cutoff; intensities greater than theshold yield dark, others yield light

w3c

Use W3C formula for calculating background text color; ignores threshold

dark

Color for dark text

light

Color for light text

Examples

Run this code
BGTextColor(background = c('black', 'white', '#E76BF3'))

Run the code above in your browser using DataLab