@@ -228,7 +228,12 @@ def get_theme_config(self) -> tuple[str, dict[str, str | int | bool]]:
228228 return self .config .html_theme , self .config .html_theme_options
229229
230230 def init_templates (self ) -> None :
231- theme_factory = HTMLThemeFactory (self .app )
231+ theme_factory = HTMLThemeFactory (
232+ confdir = self .confdir ,
233+ app = self ._app ,
234+ config = self .config ,
235+ registry = self .env ._registry ,
236+ )
232237 theme_name , theme_options = self .get_theme_config ()
233238 self .theme = theme_factory .create (theme_name )
234239 self .theme_options = theme_options
@@ -255,11 +260,6 @@ def init_highlighter(self) -> None:
255260 self .dark_highlighter : PygmentsBridge | None
256261 if dark_style is not None :
257262 self .dark_highlighter = PygmentsBridge ('html' , dark_style )
258- self .app .add_css_file (
259- 'pygments_dark.css' ,
260- media = '(prefers-color-scheme: dark)' ,
261- id = 'pygments_dark_css' ,
262- )
263263 else :
264264 self .dark_highlighter = None
265265
@@ -273,6 +273,13 @@ def css_files(self) -> list[_CascadingStyleSheet]:
273273 def init_css_files (self ) -> None :
274274 self ._css_files = []
275275 self .add_css_file ('pygments.css' , priority = 200 )
276+ if self .dark_highlighter is not None :
277+ self .add_css_file (
278+ 'pygments_dark.css' ,
279+ priority = 200 ,
280+ media = '(prefers-color-scheme: dark)' ,
281+ id = 'pygments_dark_css' ,
282+ )
276283
277284 for filename in self ._get_style_filenames ():
278285 self .add_css_file (filename , priority = 200 )
@@ -780,7 +787,7 @@ def copy_image_files(self) -> None:
780787 __ ('copying images... ' ),
781788 'brown' ,
782789 len (self .images ),
783- self .app .verbosity ,
790+ self .config .verbosity ,
784791 stringify_func = stringify_func ,
785792 ):
786793 dest = self .images [src ]
@@ -807,7 +814,7 @@ def to_relpath(f: str) -> str:
807814 __ ('copying downloadable files... ' ),
808815 'brown' ,
809816 len (self .env .dlfiles ),
810- self .app .verbosity ,
817+ self .config .verbosity ,
811818 stringify_func = to_relpath ,
812819 ):
813820 try :
@@ -1128,7 +1135,7 @@ def hasdoc(name: str) -> bool:
11281135 # 'blah.html' should have content_root = './' not ''.
11291136 ctx ['content_root' ] = (f'..{ SEP } ' * default_baseuri .count (SEP )) or f'.{ SEP } '
11301137
1131- outdir = self .app . outdir
1138+ outdir = self .outdir
11321139
11331140 def css_tag (css : _CascadingStyleSheet ) -> str :
11341141 attrs = [
0 commit comments