Skip to content

Commit 342a7f0

Browse files
authored
DOC: Add theme switcher and default to lightmode. (#414)
* DOC: Add theme switcher and default to lightmode. * Make linter happy. * Add workaround for theme versions that don't support mode switcher. * Add comment about theme version checking in conf.
1 parent a48ffc8 commit 342a7f0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/conf.py

+17
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,26 @@
8585
"show_prev_next": False,
8686
"navbar_end": ["search-field.html", "navbar-icon-links.html"],
8787
}
88+
# NOTE: The following is required for supporting of older sphinx toolchains.
89+
# The "theme-switcher" templated should be added directly to navbar_end
90+
# above and the following lines removed when the minimum supported
91+
# version of pydata_sphinx_theme is 0.9.0
92+
# Add version switcher for versions of pydata_sphinx_theme that support it
93+
import packaging
94+
import pydata_sphinx_theme
95+
96+
if packaging.version.parse(pydata_sphinx_theme.__version__) >= packaging.version.parse(
97+
"0.9.0"
98+
):
99+
html_theme_options["navbar_end"].insert(0, "theme-switcher")
100+
101+
88102
html_sidebars = {
89103
"**": [],
90104
}
105+
html_context = {
106+
"default_mode": "light",
107+
}
91108

92109
html_title = f"{project} v{version} Manual"
93110
html_last_updated_fmt = "%b %d, %Y"

0 commit comments

Comments
 (0)