PHP code example of mischiefcollective / colorjizz

1. Go to this page and download the library: Download mischiefcollective/colorjizz library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mischiefcollective / colorjizz example snippets



iefCollective\ColorJizz\Autoloader::register();


use MischiefCollective\ColorJizz\Formats\Hex;

$red_hex = new Hex(0xFF0000);
$red_cmyk = $hex->toCMYK();

echo get_class($red_cmyk); // MischiefCollective\ColorJizz\Formats\CMYK
echo $red_cmyk; // 0,1,1,0


use MischiefCollective\ColorJizz\Formats\Hex;

echo Hex::fromString('red')->hue(-20)->greyscale(); // 555555


use MischiefCollective\ColorJizz\Formats\RGB;

$red = new RGB(255, 0, 0);
echo get_class($red->hue(-20)->saturation(2)); // MischiefCollective\ColorJizz\Formats\RGB


new RGB(r, g, b);
new CMY(c, m, y);
new CMYK(c, m, y, k);
new Hex(0x000000);
new HSV(h, s, v);
new CIELab(l, a, b);
new CIELCh(l, c, h);
new XYZ(x, y, z);
new Yxy(Y, x, y);


->toRGB();
->toCMY();
->toCMYK();
->toHex();
->toHSV();
->toCIELab();
->toCIELCh();
->toXYZ();
->toYxy();