Thread (1 message) 1 message, 1 author, 2021-12-03

Re: [PATCH v3 1/4] docs: allow selecting a Sphinx theme

From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Date: 2021-12-03 14:08:32
Also in: linux-doc, lkml

Em Thu, 2 Dec 2021 12:47:00 +0100
Mauro Carvalho Chehab [off-list ref] escreveu:
Em Thu, 2 Dec 2021 12:24:53 +0100
Miguel Ojeda [off-list ref] escreveu:
quoted
On Wed, Dec 1, 2021 at 6:59 PM Mauro Carvalho Chehab
[off-list ref] wrote:  
quoted
Instead of having RTD as an almost mandatory theme, allow the
user to select other themes via a THEMES environment var.

There's a catch, though: as the current theme override logic is
dependent of the RTD theme, we need to move the code which
adds the CSS overrides to be inside the RTD theme logic.    
Does Sphinx support leaving the selection of the theme to "runtime",
i.e. to let users pick a theme from a few from a combobox (e.g.
light/dark)?

I assume not, but asking just in case.  
The RTD dark theme allows that. It basically places a <sun>/<moon>
icon. When such icon is clicked, it switches between light/dark.
Btw, I'm now using it at:

	https://linuxtv.org/downloads/v4l-dvb-apis-new/index.html

As we use a dark theme at linuxtv.org since ever.

It was built with the following script:

	CSS=linuxtv.css
	THEME=sphinx_rtd_dark_mode

	cat << EOF > $CSS
	  html body {
	    font-family: arial,helvetica,sans-serif;
	    margin: 0px;
	    padding: 0px;
	  }
	  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 SPHINXDIRS='media' CSS='$CSS' THEME='$THEME' htmldocs

Thanks,
Mauro
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help