From ac8784987f94d4ffd661964355ea70f93ec84a59 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Tue, 10 Feb 2026 10:36:06 +0100 Subject: [PATCH] Add dark mode support (#1295) Enable the theme switcher globally and add CSS dark mode rules. - Remove $config['theme_switcher'] gate so the toggle button appears on all pages - Add html.dark overrides in theme-medium.css for all content areas --- include/header.inc | 4 +- styles/theme-medium.css | 383 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 384 insertions(+), 3 deletions(-) diff --git a/include/header.inc b/include/header.inc index 48722edafa..d90a2cfd1d 100644 --- a/include/header.inc +++ b/include/header.inc @@ -254,8 +254,7 @@ if (!isset($config["languages"])) { Search docs - - - [class$="code"], +html.dark .example-contents.screen, +html.dark .informalexample .literallayout { + background-color: #111830; + box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); +} +html.dark .refsect1 .example-contents > [class$="code"], +html.dark .refsect1 .example-contents.screen { + background-color: #111830; +} +html.dark .docs .classsynopsis, +html.dark .refsect1 .fieldsynopsis, +html.dark .refsect1 .dc-description, +html.dark .docs .sect1 .dc-description { + background: #111830; + border-color: #2a3050; +} + +html.dark .phpcode span.html { + color: #e0e0e0; +} +html.dark .phpcode span.comment { + color: #7a86b8; +} +html.dark div.phpcode span.default, +html.dark div.phpcode span.variable { + color: #6ea8fe; +} +html.dark div.phpcode span.keyword { + color: #8fc98f; +} +html.dark div.phpcode span.string { + color: #f08080; +} + +html.dark .para var, +html.dark .simpara var, +html.dark .para .computeroutput, +html.dark .simpara .computeroutput { + background-color: #1e1e3a; + color: var(--content-text-color); +} + +/* Anchors */ +html.dark #layout-content a.genanchor:hover, +html.dark #layout-content a.genanchor:focus { + color: var(--content-text-color); +} + +/* Warn and info blocks */ +html.dark .warn { + border-color: var(--medium-blue-color); + background-color: #111830; +} +html.dark pre.info { + background-color: #1a1e2e; + border-color: #2a3050; +} + +/* User notes */ +html.dark #usernotes .note .name { + color: var(--content-text-color); +} +html.dark #usernotes .note .date { + color: #8888aa; +} +html.dark #usernotes .note .votes .tally { + color: var(--content-text-color); +} +html.dark #usernotes .note .votes .usernotes-voteu { + border-bottom-color: #8888aa; +} +html.dark #usernotes .note .votes .usernotes-voted { + border-top-color: #8888aa; +} +html.dark #usernotes .note .votes .usernotes-voteu:hover, +html.dark #usernotes .note .votes .usernotes-voteu:focus { + border-bottom-color: #6ea8fe; +} +html.dark #usernotes .note .votes .usernotes-voted:hover, +html.dark #usernotes .note .votes .usernotes-voted:focus { + border-top-color: #6ea8fe; +} + +/* Breadcrumbs */ +html.dark #breadcrumbs { + color: #8888aa; + background: var(--background-color); +} + +/* Left-hand sidebar menu */ +html.dark .layout-menu ul.child-menu-list li:first-child a { + border-top-color: #3a3a5a; +} +html.dark .layout-menu ul.child-menu-list a { + border-color: #3a3a5a; +} + +/* Soft-deprecation notice */ +html.dark .soft-deprecation-notice { + color: #e0e0e0; + border-color: #5a3050; + background-color: #2a1a2e; +} +html.dark .soft-deprecation-notice h1.title { + color: #c0c0d0; +} +html.dark .soft-deprecation-notice blockquote.sidebar { + color: #f08080; + border-color: #8a8a30; +} + +/* Thanks cards */ +html.dark .thanks { + box-shadow: rgba(0, 0, 0, 0.3) 0 .125rem .5rem; + background: #1a1e2e; +} +html.dark .thanks__logo { + background: #1a1e2e; +} +html.dark .thanks__logo--white { + background: #ffffff; + border-color: #2a3050; +} + +/* Contribute section */ +html.dark .contribute { + background-color: #1a1e2e; + border-color: #2a3050; +} + +/* Content box (downloads) */ +html.dark .content-box pre { + background: #111830; + border-color: #2a3050; +} + +/* Standard tables */ +html.dark table.standard { + border-color: #2a3050; +} +html.dark table.standard td, +html.dark table.standard th { + border-color: #2a3050; +} +html.dark table.standard tr:nth-child(even) td { + background-color: #1a2540; +} +html.dark table.standard th { + color: #a0a0b8; +} +html.dark table.standard tr:nth-child(even) td.subr, +html.dark table.standard tr:nth-child(even) th.subr, +html.dark table.standard tr td.subr, +html.dark table.standard tr th.subr, +html.dark table.standard tr:nth-child(even) td.sub, +html.dark table.standard tr:nth-child(even) th.sub, +html.dark table.standard tr td.sub, +html.dark table.standard tr th.sub { + background: #1a2540; +} + +/* Mobile table responsive labels */ +@media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) { + html.dark td:before { + background-color: #2a3050; + border-bottom-color: #3a3a5a; + } + html.dark td { + border-bottom-color: #2a3050; + } +} + +/* dl.qandaentry */ +html.dark dl.qandaentry { + border-color: #3a3a5a; +} + +/* Forms & inputs */ +html.dark input[type="text"], +html.dark input[type="email"], +html.dark input[type="password"], +html.dark input[type="search"], +html.dark textarea, +html.dark select { + background-color: #111830; + color: #e0e0e0; + border-color: #3a3a5a; +} + +/* Footer */ +html.dark body > footer { + color: var(--background-text-color); +} + +/* Content header changelog link */ +html.dark .content-header .changelog { + color: #6ea8fe; +} + +/* hr */ +html.dark hr { + border-top-color: #3a3a5a; +} +/* }}} */