|
208 | 208 | # The theme to use for HTML and HTML Help pages. See the documentation for |
209 | 209 | # a list of builtin themes. |
210 | 210 |
|
211 | | -# The Read the Docs theme is available from |
212 | | -# - https://github.com/snide/sphinx_rtd_theme |
213 | | -# - https://pypi.python.org/pypi/sphinx_rtd_theme |
214 | | -# - python-sphinx-rtd-theme package (on Debian) |
215 | | -try: |
216 | | - import sphinx_rtd_theme |
217 | | - html_theme = 'sphinx_rtd_theme' |
218 | | - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] |
219 | | -except ImportError: |
220 | | - sys.stderr.write('Warning: The Sphinx \'sphinx_rtd_theme\' HTML theme was not found. Make sure you have the theme installed to produce pretty HTML output. Falling back to the default theme.\n') |
| 211 | +# Default theme |
| 212 | +html_theme = 'sphinx_rtd_theme' |
| 213 | +html_css_files = [] |
| 214 | + |
| 215 | +if "DOCS_THEME" in os.environ: |
| 216 | + html_theme = os.environ["DOCS_THEME"] |
| 217 | + |
| 218 | +if html_theme == 'sphinx_rtd_theme' or html_theme == 'sphinx_rtd_dark_mode': |
| 219 | + # Read the Docs theme |
| 220 | + try: |
| 221 | + import sphinx_rtd_theme |
| 222 | + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] |
| 223 | + |
| 224 | + # Add any paths that contain custom static files (such as style sheets) here, |
| 225 | + # relative to this directory. They are copied after the builtin static files, |
| 226 | + # so a file named "default.css" will overwrite the builtin "default.css". |
| 227 | + html_css_files = [ |
| 228 | + 'theme_overrides.css', |
| 229 | + ] |
| 230 | + |
| 231 | + # Read the Docs dark mode override theme |
| 232 | + if html_theme == 'sphinx_rtd_dark_mode': |
| 233 | + try: |
| 234 | + import sphinx_rtd_dark_mode |
| 235 | + extensions.append('sphinx_rtd_dark_mode') |
| 236 | + except ImportError: |
| 237 | + html_theme == 'sphinx_rtd_theme' |
| 238 | + |
| 239 | + if html_theme == 'sphinx_rtd_theme': |
| 240 | + # Add color-specific RTD normal mode |
| 241 | + html_css_files.append('theme_rtd_colors.css') |
| 242 | + |
| 243 | + except ImportError: |
| 244 | + html_theme = 'classic' |
| 245 | + |
| 246 | +if "DOCS_CSS" in os.environ: |
| 247 | + css = os.environ["DOCS_CSS"].split(" ") |
| 248 | + |
| 249 | + for l in css: |
| 250 | + html_css_files.append(l) |
| 251 | + |
| 252 | +if major <= 1 and minor < 8: |
| 253 | + html_context = { |
| 254 | + 'css_files': [], |
| 255 | + } |
| 256 | + |
| 257 | + for l in html_css_files: |
| 258 | + html_context['css_files'].append('_static/' + l) |
| 259 | + |
| 260 | +if html_theme == 'classic': |
| 261 | + html_theme_options = { |
| 262 | + 'rightsidebar': False, |
| 263 | + 'stickysidebar': True, |
| 264 | + 'collapsiblesidebar': True, |
| 265 | + 'externalrefs': False, |
| 266 | + |
| 267 | + 'footerbgcolor': "white", |
| 268 | + 'footertextcolor': "white", |
| 269 | + 'sidebarbgcolor': "white", |
| 270 | + 'sidebarbtncolor': "black", |
| 271 | + 'sidebartextcolor': "black", |
| 272 | + 'sidebarlinkcolor': "#686bff", |
| 273 | + 'relbarbgcolor': "#133f52", |
| 274 | + 'relbartextcolor': "white", |
| 275 | + 'relbarlinkcolor': "white", |
| 276 | + 'bgcolor': "white", |
| 277 | + 'textcolor': "black", |
| 278 | + 'headbgcolor': "#f2f2f2", |
| 279 | + 'headtextcolor': "#20435c", |
| 280 | + 'headlinkcolor': "#c60f0f", |
| 281 | + 'linkcolor': "#355f7c", |
| 282 | + 'visitedlinkcolor': "#355f7c", |
| 283 | + 'codebgcolor': "#3f3f3f", |
| 284 | + 'codetextcolor': "white", |
| 285 | + |
| 286 | + 'bodyfont': "serif", |
| 287 | + 'headfont': "sans-serif", |
| 288 | + } |
| 289 | + |
| 290 | +sys.stderr.write("Using %s theme\n" % html_theme) |
221 | 291 |
|
222 | 292 | # Theme options are theme-specific and customize the look and feel of a theme |
223 | 293 | # further. For a list of options available for each theme, see the |
|
246 | 316 | # Add any paths that contain custom static files (such as style sheets) here, |
247 | 317 | # relative to this directory. They are copied after the builtin static files, |
248 | 318 | # so a file named "default.css" will overwrite the builtin "default.css". |
249 | | - |
250 | 319 | html_static_path = ['sphinx-static'] |
251 | 320 |
|
252 | | -html_css_files = [ |
253 | | - 'theme_overrides.css', |
254 | | -] |
255 | | - |
256 | | -if major <= 1 and minor < 8: |
257 | | - html_context = { |
258 | | - 'css_files': [ |
259 | | - '_static/theme_overrides.css', |
260 | | - ], |
261 | | - } |
262 | | - |
263 | 321 | # Add any extra paths that contain custom files (such as robots.txt or |
264 | 322 | # .htaccess) here, relative to this directory. These files are copied |
265 | 323 | # directly to the root of the documentation. |
|
0 commit comments