PHP code example of brio / named-colors

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

    

brio / named-colors example snippets


use Brio\NamedColors;

// Find a color from its name or reference
// Note that, if multiple matches are possible, the first match is returned
// html colors are always first to be matched
$color = NamedColors::findHexByName('red'); // returns #FF0000
$color = NamedColors::findHexByName('Google Red'); // returns #EA4335

// Find a color from its name, with a specific color set
$color = NamedColors::findHexByName('red', 'xkcd'); // returns #E50000