PHP code example of binafy / php-color-generator

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

    

binafy / php-color-generator example snippets

 >= 7.3

use Binafy\PhpColorGenerator\Color;

Color::hexToRGB('1363df');

use Binafy\PhpColorGenerator\Color;

Color::rgbToHex([
    'red' => '19',
    'green' => '99',
    'blue' => '223',
]);

use Binafy\PhpColorGenerator\Color;

Color::darken([
    'red' => '19',
    'green' => '99',
    'blue' => '223',
], 0.5); // array ('red', 'blue', 'green')

use Binafy\PhpColorGenerator\Color;

Color::lighten([
    'red' => '19',
    'green' => '99',
    'blue' => '223',
], 0.5); // array ('red', 'blue', 'green')

use Binafy\PhpColorGenerator\Color;

Color::generateShades('1363df', 10);

use Binafy\PhpColorGenerator\Color;

Color::generateTints('1363df', 10);

use Binafy\PhpColorGenerator\Color;

Color::generateDarkBrightColors('1363df', 10); // array ('dark', 'light')
shell
composer