WP_Duotone::colord_parse_hue
Converts a hue value to degrees from 0 to 360 inclusive.
Direct port of colord's parseHue function.
Method of the class: WP_Duotone{}
No Hooks.
Returns
float. The parsed hue value.
Usage
$result = WP_Duotone::colord_parse_hue( $value, $unit );
- $value(float) (required)
- The hue value to parse.
- $unit(string)
- The unit of the hue value.
Default:'deg'
Changelog
| Since 6.3.0 | Introduced. |
WP_Duotone::colord_parse_hue() WP Duotone::colord parse hue code WP 7.0
private static function colord_parse_hue( $value, $unit = 'deg' ) {
$angle_units = array(
'grad' => 360 / 400,
'turn' => 360,
'rad' => 360 / ( M_PI * 2 ),
);
$factor = $angle_units[ $unit ] ?? 1;
return (float) $value * $factor;
}