code: def _float_formatter(component: float, color: MaybeColor) -> float:
      """Convert a color component (float or int) to a float from 0.0 to 1.0.
  
      Anything too small will become 0.0, and anything too large will become 1.0.
      """
      if isinstance(component, int):
          component = component / 255.0
  
      if isinstance(component, float):
          return min(1.0, max(component, 0.0))
  
      raise InvalidColorException(color)
  
file_path: streamlit/lib/streamlit/color_util.py
imports: from typing import Any, Callable, Collection, Tuple, Union, cast
  from typing_extensions import TypeAlias
  from streamlit.errors import StreamlitAPIException
label_desc: Use image node_id 11 for calling a global function with example usage: _float_formatter(component, color) and returns: min