/** * Method to add a new color space object to the color object. * * @param Space\ColorInterface $color * @return \Pop\Color\Color */ public function addColor(Space\ColorInterface $color) { $class = get_class($color); $type = strtolower(substr($class, strrpos($class, '\\') + 1)); $this->colors[$type] = $color; if ($type != 'cmyk') { $this->colors['cmyk'] = Convert::toCmyk($color); } if ($type != 'hex') { $this->colors['hex'] = Convert::toHex($color); } if ($type != 'hsb') { $this->colors['hsb'] = Convert::toHsb($color); } if ($type != 'lab') { $this->colors['lab'] = Convert::toLab($color); } if ($type != 'rgb') { $this->colors['rgb'] = Convert::toRgb($color); } ksort($this->colors); return $this; }