View source: R/compute_deltaE.R
deltaE | R Documentation |
Compute the difference between two colors, using the CIE Delta-E 2000 formula. https://en.wikipedia.org/wiki/Color_difference#CIEDE2000.
deltaE(x, y)
x, y |
colors specified as hex strings or named R colors. |
A number quantifying the difference between x and y (or a vector thereof). A difference < 1 is imperceptible to the human eye.
Sharma, Gaurav; Wu, Wencheng; Dalal, Edul N. (2005). "The CIEDE2000 color-difference formula: Implementation notes, supplementary test data, and mathematical observations" (PDF). Color Research & Applications (Wiley Interscience) 30 (1): 21–30. doi:10.1002/col.20070
CMClc
for another metric of perceptual difference between colors and color_distance
for a numerical definition of the distance between two colors.
deltaE("pink", "hotpink") deltaE("pink", "blue") # The computation can be vectorised # For example to find the closest color in an array of possibilities clrs <- rainbow(20) show_col("pink", clrs) d <- deltaE("pink", clrs) show_col("pink", clrs[which.min(d)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.