aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/conf.py
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-12-07 10:53:02 +0100
committerJonathan Corbet <corbet@lwn.net>2021-12-10 14:05:55 -0700
commita6fb8b5acf47c5e621ae919b94c3f54e277f5039 (patch)
treed832d5f67874f266a31bc3e7bb53d2b3ffd48f58 /Documentation/conf.py
parentdocs: set format for the classic mode (diff)
downloadlinux-dev-a6fb8b5acf47c5e621ae919b94c3f54e277f5039.tar.xz
linux-dev-a6fb8b5acf47c5e621ae919b94c3f54e277f5039.zip
docs: add support for RTD dark mode
This is actually an overlay on the top of the RTD theme, which requires to include first the RTD theme. It should be noticed that, when the dark theme is used, the DOCS_CSS files won't be the last CSS themes. So, it won't override the dark.css style by default. So, it is needed to force the them override with "!important". This small script, for instance, produces a nice output with the RTD dark theme: DOCS_THEME=sphinx_rtd_dark_mode cat << EOF > dark_override.css html body { font-family: arial,helvetica,sans-serif; } html[data-theme='dark'] body { color: white !important; } html[data-theme='dark'] .sig-name { color: green !important; } html[data-theme='dark'] .wy-menu-vertical a { color: #ffcc00 !important; } html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3 { color: #ffcc00 !important; } html[data-theme="dark"] h4, html[data-theme="dark"] h5, html[data-theme="dark"] h6 { color: #ffcc00 !important; } html[data-theme="dark"] h7, html[data-theme="dark"] h8, html[data-theme="dark"] h9 { color: #ffcc00 !important; } html[data-theme="dark"] .wy-nav-content a, html[data-theme="dark"] .wy-nav-content a:visited { color: #ffcc00 !important; } EOF make DOCS_CSS=dark_override.css DOCS_THEME=sphinx_rtd_dark_mode htmldocs Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/90d316e055ef7f4c9021b9eada8f8d3b2e750a66.1638870323.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/conf.py')
-rw-r--r--Documentation/conf.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index c8efe82d1404..f07f2e9b9f2c 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -215,7 +215,7 @@ html_css_files = []
if "DOCS_THEME" in os.environ:
html_theme = os.environ["DOCS_THEME"]
-if html_theme == 'sphinx_rtd_theme':
+if html_theme == 'sphinx_rtd_theme' or html_theme == 'sphinx_rtd_dark_mode':
# Read the Docs theme
try:
import sphinx_rtd_theme
@@ -227,6 +227,19 @@ if html_theme == 'sphinx_rtd_theme':
html_css_files = [
'theme_overrides.css',
]
+
+ # Read the Docs dark mode override theme
+ if html_theme == 'sphinx_rtd_dark_mode':
+ try:
+ import sphinx_rtd_dark_mode
+ extensions.append('sphinx_rtd_dark_mode')
+ except ImportError:
+ html_theme == 'sphinx_rtd_theme'
+
+ if html_theme == 'sphinx_rtd_theme':
+ # Add color-specific RTD normal mode
+ html_css_files.append('theme_rtd_colors.css')
+
except ImportError:
html_theme = 'classic'