MCPcopy Create free account
hub / github.com/adobe/react-spectrum / distance

Function distance

scripts/convertAnatomy.js:52–54  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

50// Distance between 2 colors (in RGB)
51// https://stackoverflow.com/questions/23990802/find-nearest-color-from-a-colors-list
52function distance(a, b) {
53 return Math.sqrt(Math.pow(a.r - b.r, 2) + Math.pow(a.g - b.g, 2) + Math.pow(a.b - b.b, 2));
54}
55
56// return nearest color from array
57function nearestColor(target) {

Callers 1

nearestColorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected