From c93bb28da60a53bcd34629d7f1ea655ddcf7fac0 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 22 Oct 2024 18:45:11 +0200 Subject: [PATCH] Improve theme handling when JS is disabled --- util/gh-pages/style.css | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/util/gh-pages/style.css b/util/gh-pages/style.css index d207996ab2f6..8c5d64ad4e41 100644 --- a/util/gh-pages/style.css +++ b/util/gh-pages/style.css @@ -204,7 +204,7 @@ details[open] { } /* Expanding the mdBook theme*/ -.light { +.light, body:not([class]) { --inline-code-bg: #f6f7f6; } .rust { @@ -220,6 +220,16 @@ details[open] { --inline-code-bg: #191f26; } +@media (prefers-color-scheme: dark) { + body:not([class]) { + /* + In case JS is disabled and the user's system is in dark mode, we take "coal" as default + dark theme. + */ + --inline-code-bg: #1d1f21; + } +} + #settings-dropdown { position: absolute; margin: 0.7em;