Converts an HSLA array to HSVA.
Description
Direct port of colord’s hslaToHsva function.
Parameters
$hsla
arrayrequired- The HSLA array to convert.
Source
private static function colord_hsla_to_hsva( $hsla ) {
$h = $hsla['h'];
$s = $hsla['s'];
$l = $hsla['l'];
$a = $hsla['a'];
$s *= ( $l < 50 ? $l : 100 - $l ) / 100;
return array(
'h' => $h,
's' => $s > 0 ? ( ( 2 * $s ) / ( $l + $s ) ) * 100 : 0,
'v' => $l + $s,
'a' => $a,
);
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.