_wp_tinycolor_bound_alpha( mixed $n ): float

In this article

This function has been deprecated since 6.3.0.

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

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

VersionDescription
6.3.0Deprecated.
5.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.