@@ -15,6 +15,9 @@
1515import sys
1616import os
1717
18+# True if the readthedocs theme is locally installed
19+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
20+
1821# If extensions (or modules to document with autodoc) are in another directory,
1922# add these directories to sys.path here. If the directory is relative to the
2023# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -111,6 +114,14 @@ todo_include_todos = True
111114# a list of builtin themes.
112115html_theme = "default"
113116
117+if not on_rtd: # only import and set the theme if we're building docs locally
118+ try:
119+ import sphinx_rtd_theme
120+ html_theme = 'sphinx_rtd_theme'
121+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
122+ except ImportError:
123+ html_theme = "default"
124+
114125# Theme options are theme-specific and customize the look and feel of a theme
115126# further. For a list of options available for each theme, see the
116127# documentation.