W3cubDocs

/WordPress

_wp_tinycolor_bound_alpha( mixed $n ): float

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

Parameters

$nmixedrequired
Number of unknown type.

Return

float Value in the range [0,1].

Source

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

Changelog

Version Description
6.3.0 This function has been deprecated.
5.9.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_wp_tinycolor_bound_alpha