/** * Returns a copy of this colour with one or more channels changed. * RGB or HSL attributes may be changed, but not both at once. * @param array attributes to change */ public function with($attributes) { if ($this->assertValid($attributes, false) === 'hsl') { $colour = array_merge(array('hue' => $this->getHue(), 'saturation' => $this->getSaturation(), 'lightness' => $this->getLightness(), 'alpha' => $this->alpha), $attributes); } else { $colour = array_merge(array('red' => $this->getRed(), 'green' => $this->getGreen(), 'blue' => $this->getBlue(), 'alpha' => $this->alpha), $attributes); } $colour = new SassColour($colour); $colour->getRed(); # will get RGB and HSL return $colour; }