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
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.