PHP code example of ypho / colors

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

    

ypho / colors example snippets


// Return given color
$regularRed = Color::getSingleColor('red'); // #ef4444

// Return given color, but a darker shade of red
$amazonGreen = Color::getSingleColor('green', 8); // #166534

// Returns a palette of 10 shades of the given color
$teal = Color::getColorPalette('teal'); // ['#f0fdfa' ... '#134e4a']

// Returns all colors, in a light shade
$lightColors = Color::getColorsByShade(2); // ['#e2e8f0' ... '#fecdd3']

// Same as above, but take only three colors
$trafficLight = Color::getColorsByShade(6, ['red', 'orange', 'green']); // ['#dc2626', '#f97316', '#22c55e']