class_docstr: For the fun. Add rainbow colors to any of the other formatters.
class_docstr_tok: ["For","the","fun",".","Add","rainbow","colors","to","any","of","the","other","formatters","."]
code: def format(
      self,
      progress_bar: ProgressBar,
      progress: ProgressBarCounter[object],
      width: int,
  ) -> AnyFormattedText:
      # Get formatted text from nested formatter, and explode it in
      # text/style tuples.
      result = self.formatter.format(progress_bar, progress, width)
      result = explode_text_fragments(to_formatted_text(result))
  
      # Insert colors.
      result2: StyleAndTextTuples = []
      shift = int(time.time() * 3) % len(self.colors)
  
      for i, (style, text, *_) in enumerate(result):
          result2.append(
              (
                  style
                  + " "
                  + self.colors[(i + shift) % len(self.colors)],
                  text,
              )
          )
      return result2
  
imports: from __future__ import annotations
  import datetime
  import time
  from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING
  from prompt_toolkit.formatted_text import HTML, AnyFormattedText, StyleAndTextTuples, to_formatted_text
  from prompt_toolkit.formatted_text.utils import fragment_list_width
  from prompt_toolkit.layout.dimension import AnyDimension, D
  from prompt_toolkit.layout.utils import explode_text_fragments
  from prompt_toolkit.utils import get_cwidth
label_desc: Use image node_id 2 for calling the Rainbow obj's underlying member method code with example usage: obj.format(progress_bar, progress, width) and returns: result2