wp_tinycolor_hue_to_rgb

函数
wp_tinycolor_hue_to_rgb ( $p, $q, $t )
Access
Private
参数
  • (float) $p first component.
    Required:
  • (float) $q second component.
    Required:
  • (float) $t third component.
    Required:
返回值
  • (float) R, G, or B component.
相关
  • https://github.com/bgrins/TinyColor
定义位置
相关方法
wp_tinycolor_hsl_to_rgbwp_tinycolor_rgb_to_rgbwp_tinycolor_string_to_rgbwp_tinycolor_bound01wp_color_scheme_settings
引入
5.8.0
弃用
-

wp_tinycolor_hue_to_rgb: 该函数将色调值转换为红、绿、蓝(RGB)值: 这是由TinyColor库使用的。

hsl到rgb转换的Helper函数。

直接移植了TinyColor的函数,略微简化以保持与TinyColor的一致性。与TinyColor的一致性。

function wp_tinycolor_hue_to_rgb( $p, $q, $t ) {
	if ( $t < 0 ) {
		$t += 1;
	}
	if ( $t > 1 ) {
		$t -= 1;
	}
	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;
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 14:32:54

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: