code: def list_themes(cls, path=THEMES):
          
          themes, errors = [], OrderedDict()
  
          def load_themes(path, source):
              """
              Load all themes in the given path.
              """
              if os.path.isdir(path):
                  for filename in sorted(os.listdir(path)):
                      if not filename.endswith('.cfg'):
                          continue
  
                      filepath = os.path.join(path, filename)
                      name = filename[:-4]
                      try:
                          # Make sure the theme is valid
                          theme = cls.from_file(filepath, source)
                      except Exception as e:
                          errors[(source, name)] = e
                      else:
                          themes.append(theme)
  
          themes.extend([Theme(use_color=True), Theme(use_color=False)])
          load_themes(DEFAULT_THEMES, 'preset')
          load_themes(path, 'installed')
  
          return themes, errors
docs: Compile all of the themes configuration files in the search path.