Change colour similarity metric
authorCameron Ball <cameron@getapproved.com.au>
Thu, 16 Jul 2015 09:03:46 +0000 (17:03 +0800)
committerCameron Ball <cameron@getapproved.com.au>
Thu, 16 Jul 2015 09:03:46 +0000 (17:03 +0800)
public_html/upload.php

index cf1e765..1baa758 100644 (file)
@@ -126,7 +126,7 @@ if(isset($_POST["submit"])) {
         $green2 = hexdec(substr($rgb2,2,2));
         $blue2  = hexdec(substr($rgb2,4,2));
 
-        return abs($red1 - $red2) + abs($green1 - $green2) + abs($blue1 - $blue2) ;
+        return sqrt(pow($red1 - $red2, 2) + pow($green1 - $green2, 2) + pow($blue1 - $blue2, 2)) ;
     }
     
     function closest_colour($rgb, array $colours) {