rust-lang / blog.rust-lang.org

Home of the Rust and Inside Rust blogs
https://blog.rust-lang.org
Apache License 2.0
353 stars 277 forks source link

Add dark mode support #1184

Closed mseele closed 1 week ago

mseele commented 8 months ago

I often read the rust blog in the dark and always wonder why there is no dark mode.

It would be really cool if the rust blog had a dark mode. Is there anything against it?

CleanCut commented 8 months ago

Dark mode is well-supported in Rustdoc. Seems logical to support it here as well.

Turbo87 commented 7 months ago

@mseele do you want to help implement it? :)

mseele commented 7 months ago

@Turbo87 if anyone can help with the visual design (where to place the light/dark button, choice of colors, etc.) I can take a look

Turbo87 commented 7 months ago

unfortunately, that's the same problem we have with crates.io. we have the dev skills to implement it, but visual design is not a strong skill for us 😅

apiraino commented 7 months ago

Dark mode (imo) doesn't necessarily need a JavaScript switch button. Using the CSS prefer-color-scheme property, the browser automatically shows the website based on the user preferences (either set in the browser or in the system prefs).

An alternate color set autogenerated by a browser extension could be:

color: #e8e6e3;
background-color: #222;

replacing the SCSS variables with these should get us already to a half-working dark theme

grafik

fenhl commented 5 months ago

Here's a quick user style I threw together that can be used until this feature is implemented:

@media (prefers-color-scheme: dark) {
    body {
        background-color: black;
        filter: invert(1.0);
    }
}
teohhanhui commented 2 months ago

A very simple UserCSS: https://github.com/teohhanhui/rust-blog-dark

apiraino commented 2 months ago

sigh you guys pushed me over the cliff #1343 :smile:

apiraino commented 1 week ago

aaaand ... it's online! :rocket: