PHP code example of phpcolor / primer-colors

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

    

phpcolor / primer-colors example snippets


use PhpColor\Colors\Primer\PrimerColors as Primer;

$colors = Primer::colors();
$colors = Primer::colors('light');

$colors = Primer::colors('dark');

use PhpColor\Colors\Primer\PrimerColors as Primer;

$colors = Primer::colors();

$names = $colors->getNames(); 
// 'gray', 'blue', 'green', 'yellow', 'orange',
// 'red', 'purple', 'pink', 'coral'

use PhpColor\Colors\Primer\PrimerColors as Primer;

$colors = Primer::colors();

$shades = $colors->getShades(); 
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

use PhpColor\Colors\Primer\PrimerColors as Primer;

$colors = Primer::colors();

echo $colors->coral;           // #C4432B       
echo $colors->coral();         // #C4432B
echo $colors->coral(5)         // #C4432B

echo $colors->get('coral');    // #C4432B
echo $colors->get('coral', 5); // #C4432B