示例#1
0
 /**
  * @covers getHue
  */
 public function testGetLightness()
 {
     $color = new ColorNode('#BE3AF2', 0.5);
     $this->assertInstanceOf('ILess\\Node\\DimensionNode', $color->getLightness());
     $this->assertEquals('59%', (string) $color->getLightness());
 }
示例#2
0
 /**
  * Return a color with a 10 degree larger in hue
  *
  * @param ColorNode $color
  * @param DimensionNode $degrees
  * @return ColorNode
  */
 public function spin(ColorNode $color, DimensionNode $degrees = null)
 {
     $degrees = $degrees ? $degrees->value : 10;
     $hue = (string) fmod($color->getHue(true) + $degrees, 360);
     $hue = $hue < 0 ? 360 + $hue : $hue;
     return $this->hsla($hue, $color->getSaturation(true), $color->getLightness(true), $color->getAlpha());
 }