Skip to content

Commit ca5c6f6

Browse files
Improve theme handling when JS is disabled
1 parent c056928 commit ca5c6f6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

util/gh-pages/style.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ details[open] {
204204
}
205205

206206
/* Expanding the mdBook theme*/
207-
.light {
207+
.light, body:not([class]) {
208208
--inline-code-bg: #f6f7f6;
209209
}
210210
.rust {
@@ -220,6 +220,16 @@ details[open] {
220220
--inline-code-bg: #191f26;
221221
}
222222

223+
@media (prefers-color-scheme: dark) {
224+
body:not([class]) {
225+
/*
226+
In case JS is disabled and the user's system is in dark mode, we take "coal" as default
227+
dark theme.
228+
*/
229+
--inline-code-bg: #1d1f21;
230+
}
231+
}
232+
223233
#settings-dropdown {
224234
position: absolute;
225235
margin: 0.7em;

0 commit comments

Comments
 (0)