+ $ironlak_colours = array(
+ "532f18" => "Earth",
+ "753e00" => "Swiss",
+ "be854b" => "Mocha",
+ "e5ba83" => "Cuppa",
+ "f9e6c4" => "Irwin",
+ "fcf2e0" => "Fraser",
+
+ "be854b" => "Acacia",
+ "e5b53a" => "Tanami",
+ "f5d29c" => "Oat",
+ "ffdc01" => "Blaze",
+ "ffe04e" => "Pineapple Park",
+ "fffac4" => "Sorbet",
+
+ "de791b" => "Dieci Poes",
+ "f47d31" => "Halloween",
+ "f58427" => "Tues Afterburn",
+ "faae5d" => "Bowen",
+ "fdd29d" => "Smoothie",
+ "fcbc5e" => "Eureka",
+ "fed378" => "Butter",
+ "feefbb" => "Bondi",
+
+ "571b1e" => "Sirum Black-Red",
+ "8b0a02" => "Matador",
+ "d20d44" => "Soviet",
+ "e51a23" => "Autumn",
+ "cd4552" => "Isla Rose",
+ "f2797e" => "Guava",
+
+ "9c0159" => "Moberry",
+ "ea4498" => "Flirt",
+ "f38ab4" => "Potion",
+ "f6aec4" => "Delicious",
+ "f9cbd7" => "Crush",
+ "be76ad" => "Dusk",
+ "dd9ba5" => "Fantasia",
+ "fde6e0" => "Teegs Love",
+
+ "7e3e98" => "Pose Sushi",
+ "592049" => "Venom",
+ "78486a" => "Vino",
+ "c2739d" => "Furious",
+ "d4aed1" => "Gypsy",
+
+ "0a024e" => "Panther",
+ "62609a" => "Eggplant",
+ "7f76b7" => "Phantom",
+ "7d81be" => "Sofles Violence",
+ "8ba4d4" => "Granny",
+
+ "231f20" => "Augor's Blackout",
+ "00447b" => "Midnight",
+ "0068a9" => "Phat1's True Royal",
+ "0082c8" => "Smurf",
+ "00aeef" => "Enue's Bonggg!",
+ "78bde8" => "Torquay",
+ "89d3f4" => "Atmosphere",
+ "b9e1f7" => "Ozone",
+
+ "006b6e" => "Neverland",
+ "007b85" => "Hunter",
+ "00b5cb" => "Reef",
+ "2abdb1" => "Frazetta",
+ "8fd1c5" => "Linz Iceberg",
+ "c0e3da" => "Placid",
+ "70c6a2" => "Jante",
+
+ "006224" => "Huey",
+ "3f9537" => "Field",
+ "6cb43f" => "Cameleon",
+ "b3d78b" => "Reals Sublime",
+ "e6eebc" => "Whizbang",
+
+ "514e25" => "Askew's Olivia",
+ "677717" => "Guacamole",
+ "9ea615" => "Gangrene",
+ "ac9601" => "Banos Asbestos",
+ "d4d110" => "Kryptonite",
+ "f4eb0a" => "Keen",
+ "fcf26f" => "Nitro",
+
+ "434c3d" => "Lazy Grey",
+ "a0a1a5" => "Battleship",
+ "c5c6c8" => "Washington",
+ "f0f1f2" => "Smoulder",
+
+ "a29161" => "Gold",
+ "a8a9ad" => "Bright Chrome",
+
+ "ffffff" => "Whitest Possible",
+ "000000" => "Blackest Possible"
+ );
+
+ function colourDiff($rgb1, $rgb2) {
+ $red1 = hexdec(substr($rgb1,0,2));
+ $green1 = hexdec(substr($rgb1,2,2));
+ $blue1 = hexdec(substr($rgb1,4,2));
+
+ $red2 = hexdec(substr($rgb2,0,2));
+ $green2 = hexdec(substr($rgb2,2,2));
+ $blue2 = hexdec(substr($rgb2,4,2));
+
+ return abs($red1 - $red2) + abs($green1 - $green2) + abs($blue1 - $blue2) ;
+ }
+
+ function closest_colour($rgb, array $colours) {
+ $smallest_diff = 766;
+ $closest = 'none';
+
+ foreach($colours as $hex => $name)
+ {
+ if(colourDiff($rgb, $hex) < $smallest_diff) {
+ $smallest_diff = colourDiff($rgb, $hex);
+ $closest = $hex;
+ }
+ }
+
+ return $closest;
+ }
+