Another change for rtd
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-import sphinx_rtd_theme
-# import os
+# import sphinx_rtd_theme
+import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
@@ -87,8 +87,8 @@ todo_include_todos = False
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
-html_theme = "sphinx_rtd_theme"
-html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+# html_theme = "sphinx_rtd_theme"
+# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# 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
@@ -104,8 +104,23 @@ html_favicon = "_static/img/favicon.ico"
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
+# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+
+if not on_rtd: # only import and set the theme if we're building docs locally
+ import sphinx_rtd_theme
+ html_theme = 'sphinx_rtd_theme'
+ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+
+ # Override default css to get a larger width for local build
+ def setup(app):
+ app.add_stylesheet('css/osqp_theme.css')
+else:
html_context = {
- 'css_files': ['_static/css/osqp_theme.css'],
+ 'css_files': [
+ 'https://media.readthedocs.org/css/sphinx_rtd_theme.css',
+ 'https://media.readthedocs.org/css/readthedocs-doc-embed.css',
+ '_static/css/osqp_theme.css'],
}
