Converts a hue value to degrees from 0 to 360 inclusive.
Description
Direct port of colord’s parseHue function.
Parameters
$value
floatrequired- The hue value to parse.
$unit
stringoptional- The unit of the hue value.
Default:
'deg'
Source
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;
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.