Get the intensity and/or luminance of a color

Intensity(color)

Luminance(color)

Arguments

color

A vector of colors

Source

https://stackoverflow.com/questions/3942878/how-to-decide-font-color-in-white-or-black-depending-on-background-color

Value

A vector of intensities/luminances for each color

Examples

Intensity(color = c('black', 'white', '#E76BF3'))
#> black white #E76BF3 #> 0.00 255.00 159.58
Luminance(color = c('black', 'white', '#E76BF3'))
#> black white #E76BF3 #> 0.0000000 1.0000000 0.3397538