PHP code example of cjrasmussen / color

1. Go to this page and download the library: Download cjrasmussen/color 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/ */

    

cjrasmussen / color example snippets


use cjrasmussen\Color\ColorType\Hex;
use cjrasmussen\Color\ColorType\Rgb;
use cjrasmussen\Color\General;

$rgb = new Rgb(153, 51, 51);
$hex = $rgb->toHex();
echo $hex; // 993333

$is_hex = General::isHexColor('993333');
echo $is_hex; // true

$hex = new Hex('993333');
$rgb = $hex->toRgb();

$hsl = (new Hex('#800'))->toRgb()->toHsl();