コード例 #1
0
ファイル: HSLColorTest.php プロジェクト: hielsnoppe/phpcss
 /**
  * @dataProvider    validInputForCreation
  *
  * #depends         testCanBeCreatedFromValidInput
  *                  Sadly this is not supported by PHPUnit
  */
 public function testCanBeConvertedToRGBColor($hue, $sat, $light, $alpha, $rgbString)
 {
     $hsl = new HSLColor($hue, $sat, $light, $alpha);
     $rgb = $hsl->toRGBColor();
     $this->assertInstanceOf(RGBColor::class, $rgb);
     $string = $rgb->__toString();
     $this->assertEquals($rgbString, $string);
 }
コード例 #2
0
ファイル: Wheel.php プロジェクト: yakamoz-fang/concrete
 function current()
 {
     $h = $this->startHue + $this->step * ($this->position % $this->luminance_step);
     $s = $this->startSat;
     $l = $this->lum + $this->luminance_delta * (floor($this->position / $this->luminance_step) * 10);
     if ($l < 0) {
         $l = 100 + $l;
     }
     $l = ($l - $this->luminance_pad_left) % (100 - ($this->luminance_pad_right + $this->luminance_pad_left)) + $this->luminance_pad_left;
     $col = new HSLColor($h, $s, $l);
     return $col->toRGB()->toHex();
 }