PHP code example of soapbox / css-colors

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

    

soapbox / css-colors example snippets


"    "soapbox/css-colors": "dev-master"
}

'providers' => array(
    // ...

    'SoapBox\Csscolor\CsscolorServiceProvider'
)


Not 

$color = Csscolor::make('3D88C8');

$color->bg['0']; // returns the same colour as entered
$color->bg['+1']; // +1 to +5 and -1 to -5 to return variations of the colour to work with gradiants
$color->fg['0']; // returns a colour that can sit on the foreground of the defined hex value
...


object(SoapBox\Csscolor\Csscolor)[1109]
  public 'bg' => 
    array (size=11)
      0 => string '3D88C8' (length=6)
      '+1' => string '5a9ad0' (length=6)
      '+2' => string '6ea6d6' (length=6)
      '+3' => string '9fc4e4' (length=6)
      '+4' => string 'cee1f1' (length=6)
      '+5' => string 'ecf4fa' (length=6)
      -1 => string '3474aa' (length=6)
      -2 => string '2e6696' (length=6)
      -3 => string '1f4464' (length=6)
      -4 => string '0f2232' (length=6)
      -5 => string '060e14' (length=6)
  public 'fg' => 
    array (size=11)
      0 => string 'ffffff' (length=6)
      '+1' => string '000000' (length=6)
      '+2' => string '000000' (length=6)
      '+3' => string '000000' (length=6)
      '+4' => string '0f2232' (length=6)
      '+5' => string '1f4464' (length=6)
      -1 => string 'ffffff' (length=6)
      -2 => string 'ffffff' (length=6)
      -3 => string 'ffffff' (length=6)
      -4 => string 'cee1f1' (length=6)
      -5 => string '9fc4e4' (length=6)
  public 'minBrightDiff' => int 126
  public 'minColorDiff' => int 500