/** * @dataProvider rgb2hexProvider * @depends testNormalizeRGBValue **/ public function testRgb2hex($r, $g, $b, $sExpected) { $sHexValue = CSSColorUtils::rgb2hex($r, $g, $b); $this->assertSame($sHexValue, $sExpected); }
public function getHexValue() { $aComponents = $this->aComponents; if (isset($aComponents['a']) && $aComponents['a']->getSize() !== 1) { return null; } $sName = $this->getName(); if ($sName == 'rgb') { return CSSColorUtils::rgb2hex($aComponents['r']->getSize(), $aComponents['g']->getSize(), $aComponents['b']->getSize()); } else { if ($sName == 'hsl') { return CSSColorUtils::hsl2hex($aComponents['h']->getSize(), $aComponents['s']->getSize(), $aComponents['l']->getSize()); } } }