class_docstr: A base class for representing color objects.
  
      
class_docstr_tok: ["A","base","class","for","representing","color","objects","."]
docstr: Clamp numeric values to be non-negative, an optionally, less than a
  given maximum.
  
  Args:
      value (float) :
          A number to clamp.
  
      maximum (float, optional) :
          A max bound to to clamp to. If None, there is no upper bound,
          and values are only clamped to be non-negative. (default: None)
  
  Returns:
      float
docstr_tok: ["Clamp","numeric","values","to","be","non-negative",",","an","optionally",",","less","than","a","given","maximum",".","Args",":","value","(","float",")",":","A","number","to","clamp",".","maximum","(","float",",","optional",")",":","A","max","bound","to","to","clamp","to",".","If","None",",","there","is","no","upper","bound",",","and","values","are","only","clamped","to","be","non-negative",".","(","default",":","None",")","Returns",":","float"]
code: def clamp(value: float, maximum: float | None = None) -> float:
      """Clamp numeric values to be non-negative, an optionally, less than a
      given maximum.
  
      Args:
          value (float) :
              A number to clamp.
  
          maximum (float, optional) :
              A max bound to to clamp to. If None, there is no upper bound,
              and values are only clamped to be non-negative. (default: None)
  
      Returns:
          float
  
      """
      value = max(value, 0)
  
      if maximum is not None:
          return min(value, maximum)
      else:
          return value
  
imports: from __future__ import annotations
  import logging
  import colorsys
  from abc import ABCMeta, abstractmethod
  from math import sqrt
  from re import match
  from typing import TYPE_CHECKING, Union
  from ..core.serialization import AnyRep, Serializable, Serializer
  from ..util.deprecation import deprecated
label_desc: Use image node_id 3 for calling the Color obj's underlying member method code with example usage: obj.clamp(value, maximum) and returns: min, value