Download the PHP package mexitek/phpcolors without Composer
On this page you can find all versions of the php package mexitek/phpcolors. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phpcolors
PHPColors
A series of methods that let you manipulate colors. Just incase you ever need different shades of one color on the fly.
Requirements
PHPColors requires PHP version 7.2.0 or greater.
Installation
Composer
Simply add mexitek/phpcolors
to composer.json
using dev-master
.
How it works
Instantiate an object of the color class with a hex color string $foo = new Color("336699")
. That's it! Now, call the methods you need for different color variants.
Available Methods
- darken( [$amount] ) : Allows you to obtain a darker shade of your color. Optionally you can decide to darken using a desired percentage.
- lighten( [$amount] ) : Allows you to obtain a lighter shade of your color. Optionally you can decide to lighten using a desired percentage.
- mix($hex, [$amount] ) : Allows you to mix another color to your color. Optionally you can decide to set the percent of second color or original color amount is ranged -100...0...100.
- isLight( [$hex] ) : Determins whether your color (or the provide param) is considered a "light" color. Returns
TRUE
if color is light. - isDark( [$hex] ) : Determins whether your color (or the provide param) is considered a "dark" color. Returns
TRUE
if color is dark. - makeGradient( [$amount] ) : Returns an array with 2 indices
light
anddark
, the initial color will either be selected forlight
ordark
depending on its brightness, then the other color will be generated. The optional param allows for a static lighten or darkened amount. - complementary() : Returns the color "opposite" or complementary to your color.
- getHex() : Returns the original hex color.
- getHsl() : Returns HSL array for your color.
- getRgb() : Returns RGB array for your color.
Auto lightens/darkens by 10% for sexily-subtle gradients
Static Methods
- hslToHex( $hsl ) : Convert a HSL array to a HEX string.
- hexToHsl( $hex ) : Convert a HEX string into an HSL array.
- hexToRgb( $hex ) : Convert a HEX string into an RGB array.
- rgbToHex( $rgb ) : Convert an RGB array into a HEX string.
CSS Helpers
- getCssGradient( [$amount] [, $vintageBrowsers] ) : Generates the CSS3 gradients for safari, chrome, opera, firefox and IE10. Optional percentage amount for lighter/darker shade. Optional boolean for older gradient CSS support.
Would like to add support to custom gradient stops
However, if you want to support the ancient browsers (which has negligible market share and almost died out), you can set the second parameter to TRUE
. This will output:
Github Contributors
- mexitek
- danielpataki
- alexmglover
- intuxicated
- pborreli
- curtisgibby
- matthewpatterson
- there4
- alex-humphreys
- zaher
- primozcigler
- thedavidmeister
- tylercd100
- Braunson
License
See LICENSE file or arlo.mit-license.org