You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When mdBook is displayed with a dark theme, some elements of the browser remain rendered in a light theme, which is unfortunate since most browsers support the implementation of color-scheme: light | dark; in CSS.
Example:
Currently, in the dark theme, the scrollbars are displayed in a light color.
However, it would be sufficient to implement color-scheme: dark; on the html tag to make them dark for browsers that support it (e.g., Chrome or Edge - not Firefox).
Proposed Solution
To resolve these issues, the following two steps can be taken:
Add the following CSS rules for each theme class in the src/theme/css/variables.css file:
.coal {
--color-scheme: dark;
}
.navy {
--color-scheme: dark;
}
.ayu {
--color-scheme: dark;
}
/* For completeness, declare the rule also for light themes. */
.light {
--color-scheme: light;
}
.rust {
--color-scheme: light;
}
Add the following CSS rule for :root in the src/theme/css/general.css file:
:root {
color-scheme:var(--color-scheme);
}
Notes
No response
The text was updated successfully, but these errors were encountered:
Problem
When mdBook is displayed with a dark theme, some elements of the browser remain rendered in a light theme, which is unfortunate since most browsers support the implementation of
color-scheme: light | dark;
in CSS.Example:

Currently, in the dark theme, the scrollbars are displayed in a light color.
However, it would be sufficient to implement

color-scheme: dark;
on thehtml
tag to make them dark for browsers that support it (e.g., Chrome or Edge - not Firefox).Proposed Solution
To resolve these issues, the following two steps can be taken:
src/theme/css/variables.css
file::root
in thesrc/theme/css/general.css
file:Notes
No response
The text was updated successfully, but these errors were encountered: