Clamps a value between an upper and lower bound.
Description
Direct port of colord’s clamp function.
Parameters
$number
floatrequired- The number to clamp.
$min
floatrequired- The minimum value.
$max
floatoptional- The maximum value.
Default:
1
Source
private static function colord_clamp( $number, $min = 0, $max = 1 ) {
return $number > $max ? $max : ( $number > $min ? $number : $min );
}
Changelog
Version | Description |
---|---|
6.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.