code: def apply_theme(self, themename, themeoptions):
          
  
          # push the existing values onto the Stack
          self._theme_stack.append(
              (self.theme, self.theme_options)
          )
  
          theme_factory = HTMLThemeFactory(self.app)
          theme_factory.load_additional_themes(self.get_builtin_theme_dirs() + self.config.slide_theme_path)
  
          self.theme = theme_factory.create(themename)
          self.theme_options = themeoptions.copy()
          self.templates.init(self, self.theme)
          self.templates.environment.filters['json'] = json.dumps
  
          if self.theme not in self._additional_themes:
              self._additional_themes.append(self.theme)
docs: Apply a new theme to the document.
  
          This will store the existing theme configuration and apply a new one.