Learn R Programming

FastUtils (version 0.2.1)

getAvgHex: Compute the Average of Hex Colors

Description

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

Usage

getAvgHex(...)

Value

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

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.

Examples

Run this code
getAvgHex("#000000", "#FF00FF")
getAvgHex(c("#008040", "#000000", "#FF00FF"))

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

Run the code above in your browser using DataLab