Download the PHP package delights/color without Composer

On this page you can find all versions of the php package delights/color. 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 color

PHP Color

Tests Formats Version Total Downloads License

Installation

Requires PHP 8.3+

You can install the package via composer:

Features

TOC

Usage

Generating nice looking colors

You can generate colors on the fly:

Important: the colors generated are generate with the following defaults

This generates bright, saturated colors.

You may change the defaults for all generated colors used by the Generator.

Or some of the defaults

You may force the generator to use a certain seed:

This also works for Generator::many and Generator::manyLazily.

You may override the default hue, saturation, and lightness ranges used to generate a color:

Or specify a single number instead of a range:

The generator returns Hsla objects. Let us see how they work.

Working with the HSLA object.

You may be getting a color from somewhere which is not HSLA, you can convert them:

From RGB to HSLA

From Hex to HSLA

From scratch

You may convert your HSLA color back to hex, RGB, HSLA...

You may access the properties of the color:

And check the brightness of a color:

You may also specify a threshold, a number between 0 (darkest) and 100 (brightest):

You may darken or lighten a given color:

Luminance

As in https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef.

Contrast

As in https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef. Very useful for accessibility testing. Returns a value between 1 and 21. Usually, this is written as 1:1 or 21:1. This returns "n:1".

Testing

PHP Color was created by Félix Dorn under the MIT license.


All versions of color with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
savvot/random Version ^v0.3.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 delights/color contains the following files

Loading the files please wait ....