Skip to contents

This function computes the average color of the provided hex color values.

Usage

getAvgHex(...)

Arguments

...

Hex color values as character strings. Could also be any number of character vectors (including lists) which will all be coerced into one character, assuming they are valid hex codes.

Value

A single hex color character representing the average of the input colors.

Examples

getAvgHex("#000000", "#FF00FF")
#> [1] "#800080"
getAvgHex(c("#008040", "#000000", "#FF00FF"))
#> [1] "#552B6A"

# very nonstandard but possible way to input hexes. Essentially,
# any combination of vectors will work.
getAvgHex(list("#008040", "#000000"), "#FF00FF", c("#FF00FF"))
#> [1] "#80208F"