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 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);