colourMatch: Match Colour Specifications to Colour Names

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/colourMatch.R


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


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



An R colour specification


A list of colours


A colour metric function. See the Details Section.


Arguments passed to the colour metric function.


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


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.


Paul Murrell

See Also

This function underlies both colourName and colourSwatch.



roloc documentation built on May 1, 2019, 7:06 p.m.