class_docstr: Possible color depth values for the output.
docstr: Return the color depth if the $PROMPT_TOOLKIT_COLOR_DEPTH environment
  variable has been set.
  
  This is a way to enforce a certain color depth in all prompt_toolkit
  applications.
docstr_tok: ["Return","the","color","depth","if","the","$","PROMPT_TOOLKIT_COLOR_DEPTH","environment","variable","has","been","set",".","This","is","a","way","to","enforce","a","certain","color","depth","in","all","prompt_toolkit","applications","."]
code: def from_env(cls) -> ColorDepth | None:
      """
      Return the color depth if the $PROMPT_TOOLKIT_COLOR_DEPTH environment
      variable has been set.
  
      This is a way to enforce a certain color depth in all prompt_toolkit
      applications.
      """
      # Disable color if a `NO_COLOR` environment variable is set.
      # See: https://no-color.org/
      if os.environ.get("NO_COLOR"):
          return cls.DEPTH_1_BIT
  
      # Check the `PROMPT_TOOLKIT_COLOR_DEPTH` environment variable.
      all_values = [i.value for i in ColorDepth]
      if os.environ.get("PROMPT_TOOLKIT_COLOR_DEPTH") in all_values:
          return cls(os.environ["PROMPT_TOOLKIT_COLOR_DEPTH"])
  
      return None
  
imports: from __future__ import annotations
  import os
  from enum import Enum
label_desc: Use image node_id 1 for calling the ColorDepth obj's underlying member method code with example usage: obj.from_env(cls) and returns: None, cls, cls