hexName: Find the closest named colour to a given six character hex...

View source: R/hexName.R

hexNameR Documentation

Find the closest named colour to a given six character hex colour

Description

Find the closest named colour to a given six character hex colour

Usage

hexName(x, method = "rgb", metric = "euclidean")

Arguments

x

vector of six digit hex colours

method

colour space, either "rgb" or "hsv".

metric

distance metric, either "euclidean" or "manhattan".

Details

If metric is "euclidean", distances are root sum-of-squares differences. "manhattan" distances are the sum of absolute differences. The named colours come from the list of 657 named colours stored in R, accessible using the colors() function.

Value

vector of nearest named colour

Examples

hexName(c("#117733", "#b58900", "#855C75"))


johngodlee/JLGMisc documentation built on June 29, 2024, 9:15 p.m.