Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ Features added
Patch by Jean-François B.
* #13508: Initial support for :pep:`695` type aliases.
Patch by Martin Matouš, Jeremy Maitin-Shepard, and Adam Turner.
* #13742: HTML themes: Add dark mode support to built-in themes (``basic``,
``classic``, ``haiku``, ``nature``, ``sphinxdoc``, and ``sphinx13``).
Dark mode automatically activates based on system preferences using the
``prefers-color-scheme`` media query.
Patch by Fazeel Usmani.

Bugs fixed
----------
Expand Down
85 changes: 85 additions & 0 deletions doc/_themes/sphinx13/static/sphinx13.css
Original file line number Diff line number Diff line change
Expand Up @@ -785,3 +785,88 @@ ul.search li.kind-title {
ul.search li.kind-text {
list-style-type: "\1F4C4"; /* Unicode: Page Facing Up */
}

/* -- dark mode support ----------------------------------------------------- */

@media (prefers-color-scheme: dark) {
:root {
--colour-sphinx-blue: #1a7db8;
--colour-text: #e0e0e0;
--colour-links-light: #80cbc4;

/* darker backgrounds for admonitions */
--color-admonition-bg: hsl(0, 0%, 20%);
--color-admonition-fg: hsl(0, 0%, 70%);
--colour-warning-bg: hsl(28.5, 74%, 20%);
--colour-warning-fg: hsl(28.5, 74%, 70%);
--colour-note-bg: hsl(219.5, 84%, 20%);
--colour-note-fg: hsl(219.5, 84%, 70%);
--colour-success-bg: hsl(150, 36.7%, 20%);
--colour-success-fg: hsl(150, 36.7%, 70%);
--colour-error-bg: hsl(0, 37%, 20%);
--colour-error-fg: hsl(0, 37%, 70%);
--colour-todo-bg: hsl(266.8, 100%, 20%);
--colour-todo-fg: hsl(266.8, 100%, 70%);
}

body {
background-color: #1a1a1a;
color: #e0e0e0;
}

a {
color: #80cbc4;
}

a:visited {
color: #ce93d8;
}

code {
background-color: #2a2a2a;
color: #f1f1f1;
}

pre {
background-color: #1e1e1e;
border-color: #444;
}

div.body {
border-left-color: #1a7db8;
}

div.related {
background-color: #0a3a5a;
border-top-color: #081f35;
}

div.sphinxsidebar {
background-color: #1e1e1e;
}

div.sphinxsidebar input[type="text"] {
background-color: #2a2a2a;
border-color: #555;
color: #e0e0e0;
}

table.docutils td,
table.docutils th {
border-color: #555;
}

table.docutils thead th {
background-color: #2a2a2a;
}

dt:target,
span.highlighted {
background-color: #4a4a00;
}

div.topic {
background-color: #252525;
border-color: #444;
}
}
116 changes: 116 additions & 0 deletions sphinx/themes/basic/static/basic.css.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -904,3 +904,119 @@ div.math:hover a.headerlink {
display: none;
}
}

/* -- dark mode support ----------------------------------------------------- */

@media (prefers-color-scheme: dark) {
body {
background-color: #121212;
color: #e0e0e0;
}

a {
color: #80cbc4;
}

a:visited {
color: #ce93d8;
}

div.sphinxsidebar input {
border: 1px solid #555;
background-color: #2a2a2a;
color: #e0e0e0;
}

ul.search li p.context {
color: #aaa;
}

table.indextable tr.cap {
background-color: #2a2a2a;
}

div.modindex-jumpbox,
div.genindex-jumpbox {
border-top: 1px solid #444;
border-bottom: 1px solid #444;
}

div.sidebar,
aside.sidebar {
border: 1px solid #555;
background-color: #2a2a2a;
}

nav.contents,
aside.topic,
div.topic {
border: 1px solid #444;
background-color: #1e1e1e;
}

div.admonition {
background-color: #1e1e1e;
border: 1px solid #444;
}

table.docutils td,
table.docutils th {
border-bottom: 1px solid #555;
}

table.citation {
border-left: solid 1px #666;
}

dt:target,
span.highlighted {
background-color: #4a4a00;
}

rect.highlighted {
fill: #4a4a00;
}

.system-message {
background-color: #4a1f1f;
border: 3px solid #a00;
}

.footnote:target {
background-color: #4a4a00;
}

code,
pre {
background-color: #1e1e1e;
color: #f1f1f1;
}

div.code-block-caption {
background-color: #2a2a2a;
}

td.linenos pre {
background-color: transparent;
color: #666;
}

div.viewcode-block:target {
background-color: #3a3a2a;
}

.sig.c .k, .sig.c .kt,
.sig.cpp .k, .sig.cpp .kt {
color: #6db3f2;
}

.sig.c .m,
.sig.cpp .m {
color: #80cbc4;
}

.sig.c .s, .sig.c .sc,
.sig.cpp .s, .sig.cpp .sc {
color: #90ee90;
}
}
162 changes: 162 additions & 0 deletions sphinx/themes/classic/static/classic.css.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,165 @@ div.code-block-caption {
color: #efefef;
background-color: #1c4e63;
}

/* -- dark mode support ----------------------------------------------------- */

@media (prefers-color-scheme: dark) {
html {
background-color: #1a1a1a;
}

body {
background-color: #1e1e1e;
color: #e0e0e0;
}

div.document {
background-color: #252525;
}

div.body {
background-color: #1a1a1a;
color: #e0e0e0;
}

div.footer {
color: #aaa;
}

div.footer a {
color: #aaa;
}

div.related {
background-color: #2a2a2a;
color: #e0e0e0;
}

div.related a {
color: #80cbc4;
}

div.sphinxsidebar h3,
div.sphinxsidebar h3 a,
div.sphinxsidebar h4,
div.sphinxsidebar p,
div.sphinxsidebar ul {
color: #e0e0e0;
}

div.sphinxsidebar a {
color: #80cbc4;
}

div.sphinxsidebar input {
border: 1px solid #555;
background-color: #2a2a2a;
color: #e0e0e0;
}

{% if theme_collapsiblesidebar|tobool %}
#sidebarbutton {
background-color: #3a3a3a;
color: #e0e0e0;
border-{{side}}: 1px solid #2a2a2a;
}

#sidebarbutton:hover {
background-color: #2a2a2a;
}
{% endif %}

a {
color: #80cbc4;
}

a:visited {
color: #ce93d8;
}

{% if theme_externalrefs|tobool %}
a.external {
border-bottom: 1px dashed #80cbc4;
}

a.external:visited {
border-bottom: 1px dashed #ce93d8;
}
{% endif %}

div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
background-color: #252525;
color: #6db3f2;
border-bottom: 1px solid #444;
}

a.headerlink {
color: #80cbc4;
}

a.headerlink:hover {
background-color: #80cbc4;
color: #1a1a1a;
}

div.note {
background-color: #1e3a1e;
border: 1px solid #444;
}

div.seealso {
background-color: #3a3a1e;
border: 1px solid #666;
}

nav.contents,
aside.topic,
div.topic {
background-color: #252525;
}

div.warning {
background-color: #3a1e1e;
border: 1px solid #a66;
}

pre {
background-color: #1e1e1e;
color: #f1f1f1;
border: 1px solid #555;
}

code {
background-color: #2a2a2a;
color: #f1f1f1;
}

th, dl.field-list > dt {
background-color: #2a2a2a;
}

.warning code {
background: #4a2a2a;
}

.note code {
background: #2a3a2a;
}

div.viewcode-block:target {
background-color: #3a3a2a;
border-top: 1px solid #6db3f2;
border-bottom: 1px solid #6db3f2;
}

div.code-block-caption {
color: #e0e0e0;
background-color: #2a4a5a;
}
}
Loading
Loading