diff options
| author | bors <bors@rust-lang.org> | 2020-10-16 09:58:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-16 09:58:45 +0000 |
| commit | 6999ff33c9234b04cf5273497546b6a878bdb349 (patch) | |
| tree | ae1342bda95b2cb535812c4e955a121525e1bb3f /compiler/rustc_ast/src/util/parser.rs | |
| parent | 95b4a4f0eee935f9e0c80b0ceef34866bcb72ca3 (diff) | |
| parent | 59f9cf2ac1872866a9a2d4b83f56b96f131a6a5e (diff) | |
| download | rust-6999ff33c9234b04cf5273497546b6a878bdb349.tar.gz rust-6999ff33c9234b04cf5273497546b6a878bdb349.zip | |
Auto merge of #77809 - nasso:master, r=jyn514,guillaumegomez
Add settings to rustdoc to use the system theme This PR adds new settings to `rustdoc` to use the operating system color scheme.  `rustdoc` actually had [basic support for this](https://github.com/rust-lang/rust/blob/b1af43bc63bc7417938df056f7f25d456cc11b0e/src/librustdoc/html/static/storage.js#L121), but the setting wasn't visible and couldn't be set back once the theme was explicitly set by the user. It also didn't update if the operating system theme preference changed while viewing a page. I'm using [this method](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Testing_media_queries#Receiving_query_notifications) to query and listen to changes to the `(prefers-color-scheme: dark)` media query. I kept the old method (based on `getComputedStyle`) as a fallback in case the user-agent doesn't support `window.matchMedia` (so like... [pretty much nobody](https://caniuse.com/?search=matchMedia)). Since there's now more than one official ""dark"" theme in `rustdoc` (and also to support custom/third-party themes), the preferred dark and light themes can be configured in the settings page (the defaults are just "dark" and "light"). This is also my very first "proper" PR to Rust! Please let me know if I did anything wrong :).
Diffstat (limited to 'compiler/rustc_ast/src/util/parser.rs')
0 files changed, 0 insertions, 0 deletions
