wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_tinycolor_hue_to_rgb › WordPress Function

Since5.8.0
已弃用6.3.0
wp_tinycolor_hue_to_rgb ( $p, $q, $t )
访问:
  • private
参数: (3)
  • (float) $p first component.
    Required: Yes
  • (float) $q second component.
    Required: Yes
  • (float) $t third component.
    Required: Yes
链接:
返回:
  • (float) R, G, or B component.
定义在:
文档:

Helper function for hsl to rgb conversion.

Direct port of TinyColor's function, lightly simplified to maintain consistency with TinyColor.


源码

function wp_tinycolor_hue_to_rgb( $p, $q, $t ) {
	_deprecated_function( __FUNCTION__, '6.3.0' );

	if ( $t < 0 ) {
		++$t;
	}
	if ( $t > 1 ) {
		--$t;
	}
	if ( $t < 1 / 6 ) {
		return $p + ( $q - $p ) * 6 * $t;
	}
	if ( $t < 1 / 2 ) {
		return $q;
	}
	if ( $t < 2 / 3 ) {
		return $p + ( $q - $p ) * ( 2 / 3 - $t ) * 6;
	}
	return $p;
}