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
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ 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``, and ``sphinxdoc``). Dark mode
automatically activates based on system preferences using
``prefers-color-scheme`` media query. An optional JavaScript toggle
(``theme_toggle.js``) is also provided for manual theme switching.
Patch by Fazeel Usmani.

Bugs fixed
----------
Expand Down
263 changes: 263 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,266 @@ div.math:hover a.headerlink {
display: none;
}
}

/* -- theme toggle button --------------------------------------------------- */

.theme-toggle-button {
background-color: rgba(255, 255, 255, 0.1);
border: 1px solid #ccc;
border-radius: 4px;
padding: 5px 10px;
cursor: pointer;
font-size: 1.2em;
transition: background-color 0.3s ease;
}

.theme-toggle-button:hover {
background-color: rgba(255, 255, 255, 0.2);
}

.theme-toggle-icon {
display: inline-block;
}

/* -- 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;
}
}

/* -- manual dark mode (via data-theme attribute) --------------------------- */

[data-theme="dark"] body {
background-color: #121212;
color: #e0e0e0;
}

[data-theme="dark"] a {
color: #80cbc4;
}

[data-theme="dark"] a:visited {
color: #ce93d8;
}

[data-theme="dark"] div.sphinxsidebar input {
border: 1px solid #555;
background-color: #2a2a2a;
color: #e0e0e0;
}

[data-theme="dark"] ul.search li p.context {
color: #aaa;
}

[data-theme="dark"] table.indextable tr.cap {
background-color: #2a2a2a;
}

[data-theme="dark"] div.modindex-jumpbox,
[data-theme="dark"] div.genindex-jumpbox {
border-top: 1px solid #444;
border-bottom: 1px solid #444;
}

[data-theme="dark"] div.sidebar,
[data-theme="dark"] aside.sidebar {
border: 1px solid #555;
background-color: #2a2a2a;
}

[data-theme="dark"] nav.contents,
[data-theme="dark"] aside.topic,
[data-theme="dark"] div.topic {
border: 1px solid #444;
background-color: #1e1e1e;
}

[data-theme="dark"] div.admonition {
background-color: #1e1e1e;
border: 1px solid #444;
}

[data-theme="dark"] table.docutils td,
[data-theme="dark"] table.docutils th {
border-bottom: 1px solid #555;
}

[data-theme="dark"] table.citation {
border-left: solid 1px #666;
}

[data-theme="dark"] dt:target,
[data-theme="dark"] span.highlighted {
background-color: #4a4a00;
}

[data-theme="dark"] rect.highlighted {
fill: #4a4a00;
}

[data-theme="dark"] .system-message {
background-color: #4a1f1f;
border: 3px solid #a00;
}

[data-theme="dark"] .footnote:target {
background-color: #4a4a00;
}

[data-theme="dark"] code,
[data-theme="dark"] pre {
background-color: #1e1e1e;
color: #f1f1f1;
}

[data-theme="dark"] div.code-block-caption {
background-color: #2a2a2a;
}

[data-theme="dark"] td.linenos pre {
background-color: transparent;
color: #666;
}

[data-theme="dark"] div.viewcode-block:target {
background-color: #3a3a2a;
}

[data-theme="dark"] .sig.c .k,
[data-theme="dark"] .sig.c .kt,
[data-theme="dark"] .sig.cpp .k,
[data-theme="dark"] .sig.cpp .kt {
color: #6db3f2;
}

[data-theme="dark"] .sig.c .m,
[data-theme="dark"] .sig.cpp .m {
color: #80cbc4;
}

[data-theme="dark"] .sig.c .s,
[data-theme="dark"] .sig.c .sc,
[data-theme="dark"] .sig.cpp .s,
[data-theme="dark"] .sig.cpp .sc {
color: #90ee90;
}

[data-theme="dark"] .theme-toggle-button {
background-color: rgba(0, 0, 0, 0.3);
border-color: #555;
}

[data-theme="dark"] .theme-toggle-button:hover {
background-color: rgba(0, 0, 0, 0.5);
}
Loading
Loading