WP_Duotone::colord_parse_hue
Converts a hue value to degrees from 0 to 360 inclusive.
Direct port of colord's parseHue function.
Метод класса: WP_Duotone{}
Хуков нет.
Возвращает
float. The parsed hue value.
Использование
$result = WP_Duotone::colord_parse_hue( $value, $unit );
- $value(float) (обязательный)
- The hue value to parse.
- $unit(строка)
- The unit of the hue value.
По умолчанию:'deg'
Список изменений
| С версии 6.3.0 | Введена. |
Код WP_Duotone::colord_parse_hue() WP Duotone::colord parse hue WP 7.1
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;
}