_wp_tinycolor_bound_alpha

The timeline below displays how wordpress function _wp_tinycolor_bound_alpha has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Direct port of tinycolor's boundAlpha function to maintain consistency with
 * how tinycolor works.
 *
 * @link https://github.com/bgrins/TinyColor
 *
 * @since 5.9.0
 * @deprecated 6.3.0
 *
 * @access private
 *
 * @param mixed $n Number of unknown type.
 * @return float Value in the range [0,1].
 */
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;
}

WordPress Version: 5.9

/**
 * Direct port of tinycolor's boundAlpha function to maintain consistency with
 * how tinycolor works.
 *
 * @see https://github.com/bgrins/TinyColor
 *
 * @since 5.9.0
 * @access private
 *
 * @param mixed $n Number of unknown type.
 * @return float Value in the range [0,1].
 */
function _wp_tinycolor_bound_alpha($n)
{
    if (is_numeric($n)) {
        $n = (float) $n;
        if ($n >= 0 && $n <= 1) {
            return $n;
        }
    }
    return 1;
}