Skip to content

Instantly share code, notes, and snippets.

@perfectmak
Created January 26, 2018 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perfectmak/7b2fb7bffdf53b2651c1e198673aa9b1 to your computer and use it in GitHub Desktop.
Save perfectmak/7b2fb7bffdf53b2651c1e198673aa9b1 to your computer and use it in GitHub Desktop.
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