PHP code example of phpcolor / tailwind-colors

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


use PhpColor\Colors\Tailwind\TailwindColors as Tailwind;

$colors = Tailwind::colors();

$names = $colors->getNames(); 
// 'gray', 'red', 'yellow', 'green', 'blue', 'indigo', 'purple',
// 'pink', 'teal', 'orange', 'cyan', 'white', 'black'

use PhpColor\Colors\Tailwind\TailwindColors as Tailwind;

$colors = Tailwind::colors();

$shades = $colors->getShades(); 
// 50,  100,  200,  300,  400,  500,  600,  700,  800,  900,  950

use PhpColor\Colors\Tailwind\TailwindColors as Tailwind;

$colors = Tailwind::colors();

echo $colors->teal;             // #14b8a6       
echo $colors->teal();           // #14b8a6
echo $colors->teal(500)         // #14b8a6

echo $colors->get('teal');      // #14b8a6
echo $colors->get('teal', 500); // #14b8a6