Converts a hue value to degrees from 0 to 360 inclusive.
Direct port of colord’s parseHue function.
$valuefloatrequired
$unitstringoptional
Default:'deg'
private static function colord_parse_hue( $value, $unit = 'deg' ) {
$angle_units = array(
'grad' => 360 / 400,
'turn' => 360,
'rad' => 360 / ( M_PI * 2 ),
);
$factor = isset( $angle_units[ $unit ] ) ? $angle_units[ $unit ] : 1;
return (float) $value * $factor;
}
| Version | Description |
|---|---|
| 6.3.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_duotone/colord_parse_hue