public function deviation(ImageColor $color, $channel = null) { if ($channel === null) { list($r1, $g1, $b1) = $this->toRgb(); list($r2, $g2, $b2) = $color->toRgb(); return sqrt(pow($r1 - $r2, 2) + pow($g1 - $g2, 2) + pow($b1 - $b2, 2)) / self::MAX_DEVIATION; } return abs($this->get($channel) - $color->get($channel)) / 255; }