1. Go to this page and download the library: Download franckysolo/php-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/ */
franckysolo / php-color example snippets
hpColor\Color;
// Create an instance
$black = new Color(); // will generate a black color default
$white = new Color(255, 255, 255); // will generate a white color
$transparent = new Color(255, 255, 255, 127); // will generate a transparent color
// with static methods
$red = Color::fromArray([255, 0, 0]);
$alpha_red = Color::fromArray([100, 255, 0, 0]);
$blue = Color::fromHex('0000ff');
$aqua = Color::fromInt(Color::AQUA);
// An example of Color constants using gd
or(100, 100);
imagefill($image, 0, 0, Color::TRANSPARENT);
imagefilledrectangle($image, 25, 25, 75, 75, Color::AQUA);
imagepng($image);
imagedestroy($image);
header('Content-type: image/png');