/**
* Scales one or more property of the color by the percentage requested.
*
* @param SassColour $color the colour to adjust
* @param int $red
* @param int $green
* @param int $blue
* @param int $saturation
* @param int $lightness
* @param int $alpha
*
* @internal param $SassNumber (red, green, blue, saturation, lightness, alpha) - the amount(s) to scale by
* @return SassColour
*/
public static function scale_color($color, $red = 0, $green = 0, $blue = 0, $saturation = 0, $lightness = 0, $alpha = 0)
{
$maxes = array('red' => 255, 'green' => 255, 'blue' => 255, 'saturation' => 100, 'lightness' => 100, 'alpha' => 1);
$color->rgb2hsl();
foreach ($maxes as $property => $max) {
$obj = ${$property};
$scale = 0.01 * $obj->value;
$diff = $scale > 0 ? $max - $color->{$property} : $color->{$property};
$color->{$property} = $color->{$property} + $diff * $scale;
}
$color->hsl2rgb();
return $color;
}