Download the PHP package bondarde/php-colors without Composer

On this page you can find all versions of the php package bondarde/php-colors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-colors

PHP Colors

Creating color

Hex

Lowercase, uppercase, with/without hash:

Color::fromHex('#0f4c81');
Color::fromHex('#0F4C81');
Color::fromHex('0f4c81');
Color::fromHex('0F4C81');

RGB

Integers, floats, indexed or associative array of integers/floats:

Color::fromRgb(15, 76, 129);
Color::fromRgb([15, 76, 129]); 
Color::fromRgb([
    'r' => 15,
    'g' => 76,
    'b' => 129,
]);

Color::fromRgb(0.06, 0.3, 0.51);
Color::fromRgb([0.06, 0.3, 0.51]);
Color::fromRgb([
    'r' => 0.06,
    'g' => 0.3,
    'b' => 0.51,
]);

HSL

Integers, floats, indexed or associative array of integers/floats:

Color::fromHsl(208, 79, 28);
Color::fromHsl([208, 79, 28]); 
Color::fromHsl([
    'h' => 208,
    's' => 79,
    'l' => 28,
]);

Color::fromHsl(0.58, 0.79, 0.28);
Color::fromHsl([0.58, 0.79, 0.28]); 
Color::fromHsl([
    'h' => 208,
    's' => 79,
    'l' => 28,
]);

Color::fromHsl([208, 0.79, 0.28]); 

HSV

Integers, floats, indexed or associative array of integers/floats:

Color::fromHsv(208, 88, 51);
Color::fromHsv([208, 88, 51]); 
Color::fromHsv([
    'h' => 208,
    's' => 88,
    'v' => 51,
]);

Color::fromHsv(0.58, 0.88, 0.51);
Color::fromHsv([0.58, 0.88, 0.51]); 
Color::fromHsv([
    'h' => 0.58,
    's' => 0.88,
    'v' => 0.51,
]);

Color::fromHsv(208, 0.88, 0.51);

CMYK

Integers, floats, indexed or associative array of integers/floats:

Color::fromCmyk(88, 41, 0, 49);
Color::fromCmyk([88, 41, 0, 49]); 
Color::fromCmyk([
    'c' => 88,
    'm' => 41,
    'y' => 0,
    'k' => 49,
]);

Color::fromCmyk(0.88, 0.41, 0, 0.49);
Color::fromCmyk([0.88, 0.41, 0, 0.49]); 
Color::fromCmyk([
    'c' => 0.88,
    'm' => 0.41,
    'y' => 0,
    'k' => 0.49,
]);

Random

Generate random color:

Color::random();

Just echo it

You can use a Color object as string:

echo Color::fromHex('#0f4c81');

Color manipulations

$color->rotate(120);
$color->complementary();

Useful Information

E.g. to decide which font color to use with given background color you can detect whether the color is bright or dark:

$color->isBright();
$color->isDark();

Distance of RGB values for two given colors:

$color->distanceRgb($anotherColor);

All versions of php-colors with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bondarde/php-colors contains the following files

Loading the files please wait ....