about summary refs log tree commit diff
path: root/src/librustdoc/html/static/css
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-05 02:32:03 +0000
committerbors <bors@rust-lang.org>2024-04-05 02:32:03 +0000
commit3d7e88148a00c99e444c8f287d73ebe1846bc7aa (patch)
tree9c2e5865bef6f074b6460e36d332f4db3d78f25d /src/librustdoc/html/static/css
parent9cbaa015991b7ac5f6e1b4d713ab9096573ad30d (diff)
parente8b0c3057807e50ac1f95fdba36d79b72fbd206d (diff)
downloadrust-3d7e88148a00c99e444c8f287d73ebe1846bc7aa.tar.gz
rust-3d7e88148a00c99e444c8f287d73ebe1846bc7aa.zip
Auto merge of #123484 - jhpratt:rollup-usz4e64, r=jhpratt
Rollup of 9 pull requests

Successful merges:

 - #123206 (Require Pointee::Metadata to be Freeze)
 - #123363 (change `NormalizesTo` to fully structurally normalize)
 - #123407 (Default to light theme if JS is enabled but not working)
 - #123417 (Add Description for cargo in rustdoc documentation)
 - #123437 (Manually run `clang-format` on `CoverageMappingWrapper.cpp`)
 - #123454 (hir: Use `ItemLocalId::ZERO` in a couple more places)
 - #123464 (Cleanup: Rename `HAS_PROJECTIONS` to `HAS_ALIASES` etc.)
 - #123477 (do not ICE in `fn forced_ambiguity` if we get an error)
 - #123478 (CFI: Add test for `call_once` addr taken)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static/css')
-rw-r--r--src/librustdoc/html/static/css/noscript.css4
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/css/noscript.css b/src/librustdoc/html/static/css/noscript.css
index f425f3ec95c..ccb97d7df4c 100644
--- a/src/librustdoc/html/static/css/noscript.css
+++ b/src/librustdoc/html/static/css/noscript.css
@@ -34,7 +34,7 @@ nav.sub {
 	in rustdoc.css */
 
 /* Begin theme: light */
-:root {
+:root, :root:not([data-theme]) {
 	--main-background-color: white;
 	--main-color: black;
 	--settings-input-color: #2196f3;
@@ -140,7 +140,7 @@ nav.sub {
 
 @media (prefers-color-scheme: dark) {
 	/* Begin theme: dark */
-	:root {
+	:root, :root:not([data-theme]) {
 		--main-background-color: #353535;
 		--main-color: #ddd;
 		--settings-input-color: #2196f3;
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 9993dfb1d8c..0bb073b1cea 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -2315,8 +2315,14 @@ in src-script.js and main.js
 	tooling to ensure different themes all define all the variables. Do not
 	alter their formatting. */
 
+/*
+About `:root:not([data-theme])`: if for any reason the JS is enabled but cannot be loaded,
+`noscript` won't be enabled and the doc will have no color applied. To do around this, we
+add a selector check that if `data-theme` is not defined, then we apply the light theme
+by default.
+*/
 /* Begin theme: light */
-:root[data-theme="light"] {
+:root[data-theme="light"], :root:not([data-theme]) {
 	--main-background-color: white;
 	--main-color: black;
 	--settings-input-color: #2196f3;