MCPcopy Create free account
hub / github.com/adobe/leonardo / getColorDifference

Function getColorDifference

docs/ui/src/js/utils.js:306–314  ·  view source on GitHub ↗
(color1, color2)

Source from the content-addressed store, hash-verified

304}
305
306function getColorDifference(color1, color2) {
307 // pre-formatting and running through specific deltaE formula
308 let c1 = chroma(color1).lab();
309 let c2 = chroma(color2).lab();
310 let c1Lab = {L: c1[0], A: c1[1], B: c1[2]};
311 let c2Lab = {L: c2[0], A: c2[1], B: c2[2]};
312 // Use DeltaE 2000 formula (latest)
313 return DeltaE.getDeltaE00(c1Lab, c2Lab);
314}
315
316function groupCommonHues(colors) {
317 // colors are in put as an array of Chroma.js colors.

Callers 2

getClosestColorNameFunction · 0.90
groupCommonHuesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected