From 342a7f06ce153811cdb73c0a22be65893805e6d5 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Thu, 7 Jul 2022 15:43:19 +0300 Subject: 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. --- doc/conf.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/conf.py b/doc/conf.py index 4b36f7e..560334d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -85,9 +85,26 @@ html_theme_options = { "show_prev_next": False, "navbar_end": ["search-field.html", "navbar-icon-links.html"], } +# NOTE: The following is required for supporting of older sphinx toolchains. +# The "theme-switcher" templated should be added directly to navbar_end +# above and the following lines removed when the minimum supported +# version of pydata_sphinx_theme is 0.9.0 +# Add version switcher for versions of pydata_sphinx_theme that support it +import packaging +import pydata_sphinx_theme + +if packaging.version.parse(pydata_sphinx_theme.__version__) >= packaging.version.parse( + "0.9.0" +): + html_theme_options["navbar_end"].insert(0, "theme-switcher") + + html_sidebars = { "**": [], } +html_context = { + "default_mode": "light", +} html_title = f"{project} v{version} Manual" html_last_updated_fmt = "%b %d, %Y" -- cgit v1.2.1