colourMatch: Match Colour Specifications to Colour Names

View source: R/colourMatch.R

colourMatchR Documentation

Match Colour Specifications to Colour Names

Description

Compare colour specifications to a list of colour names and return distance information for each comparison.

Usage

colourMatch(colour, colourList, colourMetric, ...)

Arguments

colour

An R colour specification

colourList

A list of colours

colourMetric

A colour metric function. See the Details Section.

...

Arguments passed to the colour metric function.

Details

The colour metric function must take at least two arguments, both of which are "RGB" colour objects (as created by funcions in the colorspace package such as RGB): colour, which is the colour specification to find a match for; and colourList, which represents the list of colour names to find a match within. Any additional arguments must have default values (so that they do not HAVE to be specified in a call to colourName). The colour metric function must return either a vector or a list, the same length as the colour argument, containing integer indices into the colour list. NA means the colour could not be represented in the colour space used by the colour metric. "unknown" means that the colour

Value

A "colourMatch" object with components for the original colour specification, the original colour list object, and a matric of distances between each colour specification and each colour name in the colour list.

Author(s)

Paul Murrell

See Also

This function underlies both colourName and colourSwatch.

Examples

colourMatch("red", colourList=HTMLcolours)

roloc documentation built on May 29, 2024, 1:25 a.m.