Learn R Programming

roloc (version 0.1-2)

colourName: Convert a colour specification to a colour name

Description

Return a colour name from a colour specification.

Usage

# S3 method for colourMatch
colourNames(x,
                             ...)
# S3 method for default
colourNames(x,
                             colourList=getOption("roloc.colourList"),
                             colourMetric=getOption("roloc.colourMetric"),
                             ...)
colourName(...)

Value

colourNames returns a list of colour names (possibly more than one per colour specification).

colourName returns a vector of colour names (only the first match per colour specification).

Arguments

x

A "colourMatch" object or an R colour specification

colourList

A list of colours

colourMetric

A colour metric function. See colourMatch for details.

...

For colourNames, arguments passed to the colour metric function. For colourName, arguments passed to colourNames

Author

Paul Murrell

Examples

Run this code
# Some colours() are identical to each other
newColours <- colourName(rgb(t(col2rgb(colours())), maxColorValue=255))
repeats <- newColours != colours()
cbind(colours()[repeats], newColours[repeats])

Run the code above in your browser using DataLab