name2color {xkcdcolors}R Documentation

Look up a color by name

Description

Look up a color by exact or partial name.

Usage

name2color(name, exact = TRUE, hex_only = TRUE, n = -1)

Arguments

name

Character string giving color name

exact

If TRUE return only exact matches to the name, otherwise use grep to find partial matches

hex_only

If TRUE return only the color as a hex string, otherwise return the name and RGB as well

n

For partial matching, limit the results to the n highest-frequency (in the survey) colors.

Value

A character string with a hex color code, or a data frame

Author(s)

Thomas Lumley

References

http://blog.xkcd.com/2010/05/03/color-survey-results/

Examples

name2color("green")

name2color("green",exact=FALSE,hex_only=FALSE,n=10)

barplot(rep(1,10), col=name2color("green",exact=FALSE,n=10))


[Package xkcdcolors version 1.0 Index]