rgb2col | R Documentation |
colors()
It returns the closest named color within a given threshold distance.Find Named Color Closest to Given Hex RGB Colors
This function calculates the distance (in CIE Lab color space) between
the input colors (in RGB hex notation) and all named colors()
It returns the closest named color within a given threshold distance.
rgb2col(cols, near = 2.3)
cols |
A vector of colors, in RGB hex notation, e.g., |
near |
Threshold for nearest color from |
A vector of color names, or the hex value if no color is close enough
From J. Fox, R-help, 5-30-2013
cols <- c("#010101", "#EEEEEE", "#AA0000", "#00AA00", "#0000AA", "#AAAA00", "#AA00AA", "#00AAAA")
(nms <- rgb2col(cols))
pie(rep(1, 2*length(cols)), labels=c(rbind(cols, nms)), col=c(rbind(cols, nms)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.