PHP code example of sylvainjule / colorextractor

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

    

sylvainjule / colorextractor example snippets


// config/config.php
return array(
  'sylvainjule.colorextractor.mode' => 'dominant',
);

// config/config.php
return array(
  'sylvainjule.colorextractor.fallbackColor' => '#000000',
);

$image->color();

$image->color()->dominantColor();
$image->color()->averageColor();

# default values
'sylvainjule.colorextractor.palette' => [
    'hook'     => false,
    'limit'    => 10,
    'template' => null
],

# example values
'sylvainjule.colorextractor.palette' => [
    'hook'     => true,
    'limit'    => 12,
    'template' => ['template-1', 'template-2'],
    // 'template' => 'template-1', also works
],

'sylvainjule.colorextractor.default.hook' => false,