wp_tinycolor_hue_to_rgb()WP 5.8.0

Deprecated from version 6.3.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Helper function for hsl to rgb conversion.

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

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

float. R, G, or B component.

Usage

wp_tinycolor_hue_to_rgb( $p, $q, $t );
$p(float) (required)
first component.
$q(float) (required)
second component.
$t(float) (required)
third component.

Changelog

Since 5.8.0 Introduced.
Deprecated since 6.3.0

wp_tinycolor_hue_to_rgb() code WP 6.5.2

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;
}