code: private function scanThemes()
      {
          $themeDirectories = glob($this->basePath . '/*', GLOB_ONLYDIR);
  
          $themes = [];
          foreach ($themeDirectories as $themePath) {
              $json = $themePath . '/theme.json';
  
              if (file_exists($json)) {
                  $contents = file_get_contents($json);
                  if (!$contents === false) {
                      $th = $this->parseThemeInfo(json_decode($contents, true));
                      $themes[$th->getDirectory()] = $th;
                  }
              }
          }
  
          $this->themes = $themes;
  
          // if no active theme & if found 1+ theme, set first as default
          if (count($themes) && !$this->activeTheme) {
              $this->set(array_keys($themes)[0]);
          }
      }
docs: Scan for all available themes
  
  @throws ThemeInfoAttributeException