WP_Duotone::colord_hsla_to_hsva( array $hsla ): array

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Converts an HSLA array to HSVA.

Description

Direct port of colord’s hslaToHsva function.

Parameters

$hslaarrayrequired
The HSLA array to convert.

Return

array The HSVA array.

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

VersionDescription
6.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.