_wp_tinycolor_bound_alpha()WP 5.9.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.

Direct port of tinycolor's boundAlpha function to maintain consistency with how tinycolor works.

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. Value in the range [0,1].

Usage

_wp_tinycolor_bound_alpha( $n );
$n(mixed) (required)
Number of unknown type.

Changelog

Since 5.9.0 Introduced.
Deprecated since 6.3.0

_wp_tinycolor_bound_alpha() code WP 6.5.2

function _wp_tinycolor_bound_alpha( $n ) {
	_deprecated_function( __FUNCTION__, '6.3.0' );

	if ( is_numeric( $n ) ) {
		$n = (float) $n;
		if ( $n >= 0 && $n <= 1 ) {
			return $n;
		}
	}
	return 1;
}