wpseek.com
A WordPress-centric search engine for devs and theme authors



_wp_tinycolor_bound_alpha › WordPress Function

Since5.9.0
Deprecatedn/a
_wp_tinycolor_bound_alpha ( $n )
Access:
  • private
Parameters:
  • (mixed) $n Number of unknown type.
    Required: Yes
See:
Returns:
  • (float) Value in the range [0,1].
Defined at:
Codex:

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



Source

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