Package 'xkcdcolors'

Title: Color Names from the XKCD Color Survey
Description: The XKCD color survey asked participants to name colours. Randall Munroe published the top thousand(roughly) names and their sRGB hex values. This package lets you use them.
Authors: Thomas Lumley, using data from Randall Munroe and about 2.2e5 survey participants
Maintainer: Thomas Lumley <[email protected]>
License: MIT + file LICENSE
Version: 1.0
Built: 2024-11-11 04:44:20 UTC
Source: https://github.com/tslumley/xkcdcolors

Help Index


Color Names from the XKCD Color Survey

Description

The XKCD color survey asked participants to name colours. Randall Munroe published the top thousand(roughly) names and their sRGB hex values. This package lets you use them.

Details

The DESCRIPTION file:

Package: xkcdcolors
Type: Package
Title: Color Names from the XKCD Color Survey
Version: 1.0
Author: Thomas Lumley, using data from Randall Munroe and about 2.2e5 survey participants
Maintainer: Thomas Lumley <[email protected]>
Description: The XKCD color survey asked participants to name colours. Randall Munroe published the top thousand(roughly) names and their sRGB hex values. This package lets you use them.
Imports: grDevices, FNN
License: MIT + file LICENSE
Repository: https://tslumley.r-universe.dev
RemoteUrl: https://github.com/tslumley/xkcdcolors
RemoteRef: HEAD
RemoteSha: 33bfe10f77051d29267755734a47704a5e329bf7

Index of help topics:

name2color              Look up a color by name
nearest_named           Find nearest named color to a specified color.
xcolors                 List the XKCD survey colors
xkcdcolors-package      Color Names from the XKCD Color Survey

Author(s)

Thomas Lumley, using data from Randall Munroe and about 2.2e5 survey participants

Maintainer: Thomas Lumley <[email protected]>

References

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


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))

Find nearest named color to a specified color.

Description

Looks up the nearest (sufficiently popular) named color to the specified color

Usage

nearest_named(color, hex_only = FALSE, max_rank = -1, Lab=TRUE)

Arguments

color

Vector of character strings or matrix of RGB values

hex_only

if TRUE return only the hex string, otherwise all the data

max_rank

Consider only the max_rank most popular colors.

Lab

Use the 'Lab' color space if TRUE, otherwise RGB

Value

A hex string with the color, or a data frame

References

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

Examples

nearest_named("#8f7303")
nearest_named("#8f7303",max_rank=100)
nearest_named("#8f7303",max_rank=10)

List the XKCD survey colors

Description

Lists (a subset of) the 949 colors consistently identified in the XKCD web color survey.

Usage

xcolors(max_rank = -1)

Arguments

max_rank

If positive, restrict to the top (most frequently named) max_rank colors.

Value

Vector of character strings

References

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

Examples

xcolors(10)
name2color(xcolors(10))
barplot(rep(1,10),col=name2color(xcolors(10)))