Created
January 26, 2018 21:31
-
-
Save perfectmak/7b2fb7bffdf53b2651c1e198673aa9b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function distance(color1, color2) { | |
const [ r1, g1, b1 ] = color1 | |
const [ r2, g2, b2 ] = color2 | |
return Math.sqrt( | |
Math.pow(r1 - r2, 2) + Math.pow(g1 - g2, 2) + Math.pow(b1 - b2, 2) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment