PHP code example of shahonseven / php-color-hash

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

    

shahonseven / php-color-hash example snippets


$colorHash = new Shahonseven\ColorHash();

// in HSL, Hue ∈ [0, 360), Saturation ∈ [0, 1], Lightness ∈ [0, 1]
$colorHash->hsl('Hello World'); // [ 225, 0.65, 0.35 ]

// in RGB, R, G, B ∈ [0, 255]
$colorHash->rgb('Hello World'); // [ 135, 150, 197 ]

// in HEX
$colorHash->hex('Hello World'); // '#8796c5'