public function testGreyscale() { $this->assertEquals(Hex::create(0x0)->greyscale()->hex, 0x0); $this->assertEquals(Hex::create(0xff0000)->greyscale()->hex, 0x4d4d4d); $this->assertEquals(Hex::create(0xff00)->greyscale()->hex, 0x969696); $this->assertEquals(Hex::create(0xff)->greyscale()->hex, 0x1c1c1c); }
public function testWebsafe() { $this->assertEquals(Hex::fromString('CD0000')->websafe()->__toString(), 'CC0000'); $this->assertEquals(Hex::fromString('CD0100')->websafe()->__toString(), 'CC0000'); $this->assertEquals(Hex::fromString('CD00FE')->websafe()->__toString(), 'CC00FF'); $this->assertEquals(Hex::fromString('010000')->websafe()->__toString(), '000000'); }
public function testToHSVAndBack() { for ($i = 0; $i <= 0xffffff; $i += 0xccccc) { $this->assertEquals($i, Hex::create($i)->toHSV()->toHex()->hex); } }
<?php require_once '../src/MischiefCollective/ColorJizz/Autoloader.php'; MischiefCollective\ColorJizz\Autoloader::register(); use MischiefCollective\ColorJizz\Formats\Hex; echo Hex::create(0x96a)->toCIELCh()->toHex()->hue(230);
public function testWebsafe() { $this->assertEquals(Hex::fromString('FFFFFF')->complement()->__toString(), 'FFFFFF'); $this->assertEquals(Hex::fromString('FF0000')->complement()->__toString(), '00A1F3'); }