about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-10-22 18:45:11 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2024-11-01 20:20:12 +0100
commitca5c6f6c26a56f24872989b9945db40a409106df (patch)
tree6af7e97e082c1597bfa807a2a611aed70256d3b2
parentc056928af2fb09dd667c6c037bc09b0f25e7e2e3 (diff)
downloadrust-ca5c6f6c26a56f24872989b9945db40a409106df.tar.gz
rust-ca5c6f6c26a56f24872989b9945db40a409106df.zip
Improve theme handling when JS is disabled
-rw-r--r--util/gh-pages/style.css12
1 files changed, 11 insertions, 1 deletions
diff --git a/util/gh-pages/style.css b/util/gh-pages/style.css
index d207996ab2f..8c5d64ad4e4 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;