name2color: Look up a color by name

Description Usage Arguments Value Author(s) References Examples

Description

Look up a color by exact or partial name.

Usage

1
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

1
2
3
4
5
name2color("green")

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

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

xkcdcolors documentation built on May 2, 2019, 4:26 a.m.