WP_Duotone::colord_clamp( float $number, float $min, float $max = 1 ): float

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

Clamps a value between an upper and lower bound.

Description

Direct port of colord’s clamp function.

Parameters

$numberfloatrequired
The number to clamp.
$minfloatrequired
The minimum value.
$maxfloatoptional
The maximum value.

Default:1

Return

float The clamped value.

Source

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

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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