PHP code example of basekit / colortone

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

    

basekit / colortone example snippets


$swatch = ['#FFFFFF', '#01B4F0', '#70C759', '#313748', '#888888'];
$colorTone = new \ColorTone\ColorTone;
$palette = $colorTone->generatePalette($swatch);

var_dump($palette);
// array(3) {
//   ["light"]=>
//   string(7) "#FFFFFF"
//   ["dark"]=>
//   string(7) "#313748"
//   ["vibrant"]=>
//   string(7) "#01B4F0"
// }