Clamps a value between an upper and lower bound.
Direct port of colord’s clamp function.
$numberfloatrequired
$minfloatrequired
$maxfloatoptional
Default:1
private static function colord_clamp( $number, $min = 0, $max = 1 ) {
return $number > $max ? $max : ( $number > $min ? $number : $min );
}
| Version | Description |
|---|---|
| 6.3.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_duotone/colord_clamp