$G = hexdec($color[2].$color[3]);
$B = hexdec($color[4].$color[5]);
- $HSL = array();
+ $HSL = [];
$var_R = ($R / 255);
$var_G = ($G / 255);
* @return string HEX string
* @throws Exception "Bad HSL Array"
*/
- public static function hslToHex( $hsl = array() ){
+ public static function hslToHex( $hsl = [] ){
// Make sure it's HSL
if(empty($hsl) || !isset($hsl["H"]) || !isset($hsl["S"]) || !isset($hsl["L"]) ) {
throw new Exception("Param was not an HSL array");
}
- list($H,$S,$L) = array( $hsl['H']/360,$hsl['S'],$hsl['L'] );
+ list($H,$S,$L) = [ $hsl['H']/360,$hsl['S'],$hsl['L'] ];
if( $S == 0 ) {
$r = $L * 255;
* @return string RGB string
* @throws Exception "Bad RGB Array"
*/
- public static function rgbToHex( $rgb = array() ){
+ public static function rgbToHex( $rgb = [] ){
// Make sure it's RGB
if(empty($rgb) || !isset($rgb["R"]) || !isset($rgb["G"]) || !isset($rgb["B"]) ) {
throw new Exception("Param was not an RGB array");
}
// Return our gradient array
- return array( "light" => $lightColor, "dark" => $darkColor );
+ return [ "light" => $lightColor, "dark" => $darkColor ];
}
// Return the new value in HEX
return self::hslToHex($hsl);
}
-
+
/**
* Returns your color's HSL array
*/
public function getRgb() {
return $this->_rgb;
}
-
+
/**
* Returns the cross browser CSS3 gradient
* @param int $amount Optional: percentage amount to light/darken the gradient
$hsl['L'] = ($hsl['L'] < 0) ? 0:$hsl['L']/100;
} else {
// We need to find out how much to darken
- $hsl['L'] = $hsl['L']/2 ;
+ $hsl['L'] = $hsl['L']/2;
}
return $hsl;
$gmix = (($rgb1['G'] * $r1) + ($rgb2['G'] * $r2)) / 2;
$bmix = (($rgb1['B'] * $r1) + ($rgb2['B'] * $r2)) / 2;
- return array('R' => $rmix, 'G' => $gmix, 'B' => $bmix);
+ return ['R' => $rmix, 'G' => $gmix, 'B' => $bmix];
}
/**