Classify themes as light/dark and fallback to the base light/dark theme if theme does not exist #74937
Labels
A-rustdoc-themes
Area: Themes for HTML pages generated by rustdoc
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
See rust-lang/docs.rs#919 for some context.
When browsing docs within a single Web context (a.k.a. a single instance of
LocalStorage
, mostly based on the domain but also affected by other details) generated from multiple versions ofrustdoc
(or with custom themes) you may set the selected theme to one that does not exist in all the documentation. When loading a page with an unknown themerustdoc
will just leave the theme as the defaultlight
theme, which can result in suddenly been blinded if generally using a dark theme in a dark room.To avoid the binding effect it would be good to have all builtin (and custom) themes classified into light or dark, and fallback to the base light/dark theme as appropriate when the exact theme requested is unknown. This will have to be implemented something like storing the classification into local-storage alongside the theme itself, since the rustdoc JS loading the theme will not know the theme to classify it itself.
If anyone can think of a plan that is backwards compatible with both pre-ayu rustdoc, and the current nightlies with ayu available, it'd be great if we can get this working across all versions on docs.rs somehow; but I doubt this is possible, so probably best to focus on just getting something that works on documentation generated going forward.
The text was updated successfully, but these errors were encountered: