WP_Duotone::colord_hsla_to_hsva
Converts an HSLA array to HSVA.
Direct port of colord's hslaToHsva function.
Method of the class: WP_Duotone{}
No Hooks.
Returns
Array. The HSVA array.
Usage
$result = WP_Duotone::colord_hsla_to_hsva( $hsla );
- $hsla(array) (required)
- The HSLA array to convert.
Changelog
| Since 6.3.0 | Introduced. |
WP_Duotone::colord_hsla_to_hsva() WP Duotone::colord hsla to hsva code WP 6.8.3
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,
);
}