Download the PHP package fonil/coloreeze without Composer
On this page you can find all versions of the php package fonil/coloreeze. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package coloreeze
coloreeze
A PHP library to deal with color conversions
[TOC]
Summary
Coloreeze is a PHP library to deal with color conversions.
Currently it supports the following color spaces:
- Hexadecimal
- Integer
- RGB(a)
- HSB/HSV
- HSL
- CMYK
- CIELab
- XYZ
Features
Additionally this library contains some useful methods to:
- Generate a greyscale version from a color
- Generate a darker version from a color
- Generate a lighter version from a color
- to create gradients and measure the distance CIE76 between colors.
Installation
You can install the package via composer:
Usage
Coloreeze
package contains independent color classes, all of them implementing a Color
interface:
- ColorCIELab
- ColorCMYK
- ColorFactory
- ColorHSB
- ColorHSL
- ColorHex
- ColorInt
- ColorRGBA
- ColorXYZ
Color Factory
ColorFactory::fromString(string $input): Color
The ColorFactory
class allows you to create a color instance from any valid input string.
If the input string is not a valid color representation it throws an InvalidInput
exception.
Color Interface
__toString(): string
Cast the color value to a string:
fromString(string $input): Color
Parses an input string and returns accordingly the related Color
implementation:
It throws an InvalidInput
exception in case of the string is not well formed or unsupported color.
getValue(): mixed
Returns the Color
value. On single-value colors, this method returns a primitive value (int or string) but on composite ones it returns an array with color's components:
toCIELab(): ColorCIELab
Converts a color to a CIELab:
toCMYK(): ColorCMYK
Converts a color to a CMYK:
toHex(): ColorHex
Converts a color to a Hex:
toHSB(): ColorHSB
Converts a color to a HSB/HSV:
toHSL(): ColorHSL
Converts a color to a HSL:
toInt(): ColorInt
Converts a color to an Int:
toRGBA(): ColorRGBA
toXYZ(): ColorXYZ
toComplementary(): Color
toGreyscale(): Color
adjustBrightness(int $steps): Color
distanceCIE76(Color $color): float
Testing
You can run the test suite via composer:
This Composer script runs the PHPUnit command with PCOV support in order to generate a Code Coverage report.
Unit Tests
This library provides a PHPUnit testsuite with 1434 unit tests and 2670 assertions:
Code Coverage
Here is the Code Coverage report summary:
Full report will be generated in ./reports/coverage folder.
QA
Static Analyzer
You can check this library with PHPStan:
This command generates the following report:
PHP Parallel Lint
You can check this library with PHP Parallel Lint:
This command generates the following report:
PHP Insights
You can check this library with PHP Insights:
This command generates the following summary:
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities:
PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY
Supported Versions
Only the latest major version receives security fixes.
Reporting a Vulnerability
If you discover a security vulnerability within this project, please open an issue here. All security vulnerabilities will be promptly addressed.
License
The MIT License (MIT). Please see License File for more information.