-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please provide a dark theme for non-rustdoc pages on docs.rs #918
Comments
There is a userstyle for this https://github.com/Cldfire/ayu-rs, and @Cldfire has expressed interest in getting it integrated into docs.rs proper. |
I would be more than happy to work on this if we can come up with a plan that is satisfactory for the docs.rs maintainers. I know @pietroalbini expressed concerns with the idea of styling the front page and such. |
More discussion on this around https://discordapp.com/channels/442252698964721669/541978667522195476/731948537591365642. The main thing that was hard was syncing the theme preference to the rustdoc selection, because we don't control rustdoc CSS or the way it stores preferences. If we started with a less ambitious goal of having a dark theme at all, I think this would be more doable. @Cldfire are you interested in making a PR for adding a dark theme? The relevant code is Line 6 in 731d031
I guess another issue is how to switch between themes; right now docs.rs doesn't have a settings page at all. So maybe we should sync with rustdoc after all? I'm not sure how hard that would be. |
Would it be simpler, rather than tying it to the rustdoc theme selection, to just use the user's browser setting for |
Ooh, |
I think having an explicit toggle still is very important for browsers that don't support setting the colorscheme (preferably with a default "use |
My main fear with going this route is that it creates a poor UX for users of docs.rs. Instead of simply changing the rustdoc theme and seeing the appropriate change occur to the docs.rs bar at the top of the screen, you'd also have to go toggle the docs.rs theme. This seems like a unnecessary extra step that will quickly become annoying. Also... what do we use for the "dark" theme styling? The ayu theme? Then it looks out of place with rustdoc's dark theme. The dark theme? Then it looks out of place with rustdoc's ayu theme. Not ideal.
Agreed, this is a problem, especially when the switchTheme(getCurrentValue("rustdoc-theme") || getSystemValue() || "light", false); and we could of course replicate that in docs.rs, but there's no guarantee that it stays in sync with rustdoc. Could we perhaps extract theme preference logic into a small, common JS lib that could be shared between docs.rs, rustdoc, and any other Rust-related sites that wished to sync with rustdoc theme selections? Then we could:
There remains the problem of rustdoc versioning; we'd need to make sure the extracted library was always backwards-compatible with previous versions of itself in order to properly support older docs on docs.rs. This route is definitely more work, but it would result in a much nicer UX for docs.rs. Let's at least rule something like this out before we continue on with another idea! |
I like this idea. Cargo does something similar with https://docs.rs/cargo-platform/0.1.1/cargo_platform/. |
|
Hmm, that looks like a lot of JS to include just to provide a dark theme. I'd much prefer to simply use CSS and keep added JS minimal to accomplish this goal 🙂. |
Agreed, I love darkreader and use it as a daily driver, but in the wrong conditions it's absurdly heavy and large doc pages are a place it can struggle |
Maybe we could implement that just for now and fix it the 'right way' later? It's only one line of code and it's a lot less hassle to deal with. |
I'm certainly fine with hardcoding things if other people would be ok with that as well. I'm just waiting for a consensus to be reached here before I go to the effort of implementing something 😄 |
So, I was thinking about how to get access to |
We'll still pick it up the next time you visit a rustdoc page, right? That seems like enough of an edge case I don't mind if it's not handled. |
I have a working implementation of watching the rustdoc theme (needs to use an iframe rather than a worker because for some reason neither dedicated or shared workers get the |
That's awesome! I'm happy to help with the CSS once the theme infrastructure is in place 👍 |
Added in #1116. |
The rustdoc pages on docs.rs have all the theme options rustdoc normally provides; however, the search pages and the front page always use a light theme, which can be jarring. I'd love to see an adaptation of
ayu.css
for the non-rustdoc portions of docs.rs.The text was updated successfully, but these errors were encountered: