phpColors is an interesting library that makes it easy to work with colors in PHP. It can determine whether a color is dark or light, as well as darken or lighten a color incrementally, as well as generate complementary colors. It has functions that output hexadecimal or HSL representations of the color, or a gradient array.
It makes it super easy to do something like this:
using phpColors\Color;
$color = new Color("#eeeeee");
if ( $color->isLight() ) {
$gradient = $color->makeGradient();
// array( "light" => "the_light_color_hex", "dark" => "the_dark_color_hex" )
}
phpColors [GitHub]










