Download the PHP package dewsign/color without Composer
On this page you can find all versions of the php package dewsign/color. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dewsign/color
More information about dewsign/color
Files in dewsign/color
Package color
Short Description A micro package to convert and alter colors!
License MIT
Informations about the package color
Color
A micro PHP package to convert and alter colors! 🔥 Forked from liquidpineapple/color, which seems to have vanished from github completley...
Contents of this document:
- Installation
- Documentation
- Contributing
Installation
You can install this package through composer. To install the latest version in to your project use the following command:
This package requires PHP 7.0 or higher.
Documentation
Table of contents:
-
Conversion
b) Output
a) Types
-
Alteration
a) Lightness
b) Saturation
1. Conversion
You can use this package to convert colors to different notations. An example might be converting HEX to RGB:
1a. Output
In some cases you might want an output like rgb(30, 144, 255)
. This can be done using the following method:
1b. Types
You can convert from the following types:
- HEX:
fromHEX($hex)
- RGB:
fromHEX($red, $green, $blue)
- HSL:
fromHSL($hue, $saturation, $lightness)
- HSV:
fromHSV($hue, $saturation, $value)
To the following types
- HEX:
toHEX()
&toHEXString()
(alias oftoHEX()
) - RGB:
toRGB()
&toRGBString()
- HSL:
toHSL()
&toHSLString()
- HSV:
toHSV()
&toHSVString()
2. Alteration
Sometimes just conversion isn't enough, in some cases you might want to darken or saturate a color. Luckily, this is a breeze with this package.
2a. Lightness
You can alter the lightness of the color using the following methods:
lighten($amount)
darken($amount)
The amount in both message is a percentage. An example:
2b. Saturation
Just as with lightness you can alter the saturation of a given color. This can be done using the following methods:
saturate($amount)
desaturate($amount)
The amount in both message is a percentage. An example: