Find close R colors() to a given color (original by Marius Hofert) using Euclidean norm in (HSV / RGB / ...) color space

nearRcolor(
  rgb,
  cSpace = c("hsv", "rgb255", "Luv", "Lab"),
  dist = switch(cSpace, hsv = 0.1, rgb255 = 30, Luv = 15, Lab = 12)
)

Arguments

rgb

Can be character string of built-in R color name like "tomato" or color rgb as vector ex c(255,99,71)

Author

Marius Hofert, originally