rgb() public method

Sets xy and brightness calculated from RGB
public rgb ( integer $red, integer $green, integer $blue ) : self
$red integer Red value
$green integer Green value
$blue integer Blue value
return self This object
Example #1
0
 /**
  * Test: invalid RGB value
  *
  * @dataProvider providerInvalidRGB
  *
  * @covers \Phue\Command\SetLightState::rgb
  *
  * @expectedException \InvalidArgumentException
  */
 public function testInvalidRGBValue($red, $green, $blue)
 {
     $_x = new SetLightState($this->mockLight);
     $_x->rgb($red, $green, $blue);
 }
Example #2
0
File: Light.php Project: sqmk/phue
 /**
  * Set XY and brightness calculated from RGB
  *
  * @param int $red   Red value
  * @param int $green Green value
  * @param int $blue  Blue value
  *
  * @return self This object
  */
 public function setRGB($red, $green, $blue)
 {
     $x = new SetLightState($this);
     $y = $x->rgb((int) $red, (int) $green, (int) $blue);
     $this->client->sendCommand($y);
     // Change internal xy, brightness and colormode state
     $xy = ColorConversion::convertRGBToXY($red, $green, $blue);
     $this->attributes->state->xy = array($xy['x'], $xy['y']);
     $this->attributes->state->bri = $xy['bri'];
     $this->attributes->state->colormode = 'xy';
     return $this;
 }