File tree 2 files changed +9
-3
lines changed
src/librustdoc/html/static/css
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ nav.sub {
34
34
in rustdoc.css */
35
35
36
36
/* Begin theme: light */
37
- : root {
37
+ : root , : root : not ([ data-theme ]) {
38
38
--main-background-color : white;
39
39
--main-color : black;
40
40
--settings-input-color : # 2196f3 ;
@@ -140,7 +140,7 @@ nav.sub {
140
140
141
141
@media (prefers-color-scheme : dark) {
142
142
/* Begin theme: dark */
143
- : root {
143
+ : root , : root : not ([ data-theme ]) {
144
144
--main-background-color : # 353535 ;
145
145
--main-color : # ddd ;
146
146
--settings-input-color : # 2196f3 ;
Original file line number Diff line number Diff line change @@ -2315,8 +2315,14 @@ in src-script.js and main.js
2315
2315
tooling to ensure different themes all define all the variables. Do not
2316
2316
alter their formatting. */
2317
2317
2318
+ /*
2319
+ About `:root:not([data-theme])`: if for any reason the JS is enabled but cannot be loaded,
2320
+ `noscript` won't be enabled and the doc will have no color applied. To do around this, we
2321
+ add a selector check that if `data-theme` is not defined, then we apply the light theme
2322
+ by default.
2323
+ */
2318
2324
/* Begin theme: light */
2319
- : root [data-theme = "light" ] {
2325
+ : root [data-theme = "light" ], : root : not ([ data-theme ]) {
2320
2326
--main-background-color : white;
2321
2327
--main-color : black;
2322
2328
--settings-input-color : # 2196f3 ;
You can’t perform that action at this time.
0 commit comments