rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.25k stars 1.64k forks source link

Implement auto dark mode in CSS #2440

Closed atjn closed 1 week ago

atjn commented 1 month ago

Problem

Currently, the page will load with a default light style, then JS will take over and if it detects that it is in "auto theme" mode and that the browser is in dark mode, it replaces the light colors with dark colors. This causes a few problems:

Proposed Solution

You can use CSS media queries to perform the dark mode check inside the CSS.

Notes

Related: #1504

atjn commented 1 month ago

This was apparently already implemented in #1069 but has regressed since then. I plan on submitting a bug fix soon.

atjn commented 1 month ago

@rustbot claim

ehuss commented 1 week ago

I'm going to close as I think this should be resolved by #2454.