Direct port of tinycolor’s boundAlpha function to maintain consistency with how tinycolor works.
$nmixedrequired
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;
}
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_wp_tinycolor_bound_alpha