deltaE: Compute the Delta-E between two colors

View source: R/compute_deltaE.R

deltaER Documentation

Compute the Delta-E between two colors

Description

Compute the difference between two colors, using the CIE Delta-E 2000 formula. https://en.wikipedia.org/wiki/Color_difference#CIEDE2000.

Usage

deltaE(x, y)

Arguments

x, y

colors specified as hex strings or named R colors.

Value

A number quantifying the difference between x and y (or a vector thereof). A difference < 1 is imperceptible to the human eye.

References

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

See Also

CMClc for another metric of perceptual difference between colors and color_distance for a numerical definition of the distance between two colors.

Examples

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)])

jiho/chroma documentation built on Nov. 26, 2022, 2:39 a.m.