Download the PHP package cyberalien/color without Composer

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

Why create yet another color library?

I needed library that:

There was no library that matched these requirements.

This library is available in 2 languages to make it usable in both client side web components and server side scripts:

Features

Library has only 1 object: Color

Color object represents color. You can:

Class automatically converts between color spaces when needed.

Code is optimized for performance. Unusual coding style was used to make code consistent between different programming languages.

Usage

use \CyberAlien\Color;

// Create simple color object, get HEX string
$color = new Color();
$color->setRGB(10, 20, 30);
$color->toHex();

// Create color object from string
$color = Color.fromString('rgba(10, 20, 30, .5)');
$color->getRGBA();

// Change color components in different color spaces
$color = Color.fromString('#f00');
$color->setHue(180);
$color->toString(); // '#00ffff'
$color->toHex(true); // '#0ff' - compressed hex string

// Mix colors
$color = Color.fromString('blue');
$color2 = Color.fromString('red');
$color->mix($color2, 50); // 50% of each color
$color->toKeyword(); // 'purple'

// Manipulate color spaces
$color = Color.fromString('yellow');
$color->setHue($color->getHue() + 180);
$color->setLightness(25);
$color->toHex(); // '#000080'
$color->toHSLString(); // 'hsl(240, 100%, 25%)'

// Calculate contrast between 2 colors
$color = Color.fromString('yellow');
$color2 = Color.fromString('darkblue');
$color->getContrast($color2); // 14.245...

Documentation

Documentation will be added later, when new website is ready.

For now you can easily figure it out by reading function names and docblocks in src/color.js or lib/color.php Code is well documented.

Color values use following ranges:

Requirements

PHP library requires PHP 5.4 or newer version.

JavaScript library is written in ES6, but is compiled into ES5 code for older browsers.

Unit tests

To run tests run this command:

./bin/phpunit

or, if you have Node.js installed:

npm test

License

This library is licensed under MIT license. That means you can use it in both open source and commercial projects.


All versions of color with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
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 cyberalien/color contains the following files

Loading the files please wait ...