Default to light theme is JS is enabled but not working

This commit is contained in:
Guillaume Gomez 2024-04-03 14:11:01 +02:00
parent c7491b9733
commit 2edc54c830
2 changed files with 9 additions and 3 deletions

View File

@ -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;

View File

@ -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;