WP_Duotone::colord_clamp()private staticWP 6.3.0

Clamps a value between an upper and lower bound.

Direct port of colord's clamp function.

Method of the class: WP_Duotone{}

No Hooks.

Return

float. The clamped value.

Usage

$result = WP_Duotone::colord_clamp( $number, $min, $max );
$number(float) (required)
The number to clamp.
$min(float)
The minimum value.
$max(float)
The maximum value.
Default: 1

Changelog

Since 6.3.0 Introduced.

WP_Duotone::colord_clamp() code WP 6.5.3

private static function colord_clamp( $number, $min = 0, $max = 1 ) {
	return $number > $max ? $max : ( $number > $min ? $number : $min );
}