1. Go to this page and download the library: Download delights/color 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/ */
delights / color example snippets
use Felix\PHPColor\Generator;
Generator::one();
Generator::many(n: 10)
Generator::manyLazily(n: 10_000)
$color->hue; # between 0-360
$color->saturation; # between 0-100
$color->lightness; # between 0-100
$color->alpha; # between 0-100
$color->setHue(...)->setSaturation(...)->setLightness(...)->setAlpha(...); // modifies the color
$color->withHue(...) // returns a new instance
$color->withSaturation(...); // returns a new instance
$color->withLightness(...); // returns a new instance
$color->withAlpha(...); // returns a new instance
// If you chain more than one with...(), use clone() + set...() instead:
$color->clone()
->setHue(...)
->setSaturation(...)
->setLightness()
->setAlpha();
$color->colorChannels(); // returns [r, g, b]
$color->red(); // 0-255
$color->green(); // 0-255
$color->blue(); // 0-255
$color->isDark();
$color->isBright();
$color->isDark(threshold: 5);
// Returns a new instance of the color
$color->darken($percentage = 15);
$color->lighten($percentage = 15);
$color->luminance(); // 0.0 - 1.0
$color->contrast($otherColor); // 1 - 21
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.