closestRcolor | R Documentation |
Find the closest R color for a vector of colors
closestRcolor(
x,
colorSet = colors(),
C_min = Cgrey,
Cgrey = getOption("jam.Cgrey", 5),
showPalette = FALSE,
colorModel = c("hcl", "LUV"),
Hwt = 2.5,
Cwt = 1,
Lwt = 4,
warpHue = TRUE,
preset = "ryb",
method = "maximum",
returnType = c("color", "name", "match"),
verbose = FALSE,
...
)
x |
character vector of colors, either in hex format or any valid color in R. |
colorSet |
|
C_min , Cgrey |
Reworded in short:
|
Cgrey |
|
showPalette |
|
colorModel |
|
Hwt , Cwt , Lwt |
|
warpHue |
|
preset |
|
method |
|
returnType |
|
verbose |
|
This function is intended as a relatively efficient method to compare
a set of colors to the named R colors provided by grDevices::colors()
.
Color matching provides substantial improvements over similar functions from other R packages. Notably, colors are matched using either HCL or LUB color model by default, both of which provide vast improvement over RGB color matching, due to better spacing of colors, and increased resolution of color hue.
For colorModel="HCL"
the coordinates are weighted to prioritize
matching color Hue above Chroma and Luminance. The distance method
by default uses method="maximum"
which also emphasizes the lowest
distance in any of the three dimensions.
character
vector of colors, optionally customized
by argument returnType
.
Other colorjam core:
blend_colors()
,
closest_named_color()
,
color_complement()
,
colors_to_df()
,
group2colors()
,
rainbowJam()
,
sort_colors()
,
subset_colors()
closestRcolor(rainbowJam(12), showPalette=TRUE);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.