Skip to content

Commit

Permalink
Merge pull request #194 from scottclowe/doc_autotheme
Browse files Browse the repository at this point in the history
DOC: Graceful degradation of sphinx theme
  • Loading branch information
scottclowe committed Jun 21, 2021
2 parents 4e75076 + 2351752 commit 60cbebc
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions docs/conf.py
Expand Up @@ -161,14 +161,18 @@ def setup(app):
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
try:
# Use pydata on Python 3.6 and above
import pydata_sphinx_theme

html_theme = "pydata_sphinx_theme"
except ImportError:
# Use readthedocs theme
html_theme = "sphinx_rtd_theme"
# Use pydata on Python 3.6 and above. If it is not available, use the
# readthedocs theme. If that is unavailable, use the default builtin theme.

for name in ["pydata_sphinx_theme", "sphinx_rtd_theme"]:
try:
__import__(name)
html_theme = name
break
except ImportError:
pass
else:
print("No sphinx theme installed. Using default theme.")

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down

0 comments on commit 60cbebc

Please sign in to comment.