diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2021-11-22 23:30:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-22 23:30:29 +0100 |
| commit | cb7776758c4ce20e7b20526cc753cf33a9ba6bdf (patch) | |
| tree | 1edf962825a808486de00ef5a609a726d609ec56 | |
| parent | 936f2600b6c903b04387f74ed5cbce88bb06d243 (diff) | |
| parent | a56559df1346c44aa058f3a82785f20230a0468f (diff) | |
| download | rust-cb7776758c4ce20e7b20526cc753cf33a9ba6bdf.tar.gz rust-cb7776758c4ce20e7b20526cc753cf33a9ba6bdf.zip | |
Rollup merge of #91102 - jsha:theme-anchor, r=GuillaumeGomez
Set color for <a> in a more straightforward way. Previously, we set the default color for <a> tags to black, and then had an override with a bunch of not() clauses to set anchors in docblocks to blue. Instead, we should set the default color for <a> to blue (or equivalent in other themes), and override it for places like the sidebar or search results, where we don't want them to be styled as links. Demo at https://rustdoc.crud.net/jsha/theme-anchor/std/string/struct.String.html. This should result in no visible changes. r? `@GuillaumeGomez`
| -rw-r--r-- | src/librustdoc/html/static/css/rustdoc.css | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/ayu.css | 17 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/dark.css | 23 | ||||
| -rw-r--r-- | src/librustdoc/html/static/css/themes/light.css | 23 | ||||
| -rw-r--r-- | src/test/rustdoc-gui/anchors.goml | 17 | ||||
| -rw-r--r-- | src/tools/rustdoc-gui/tester.js | 8 |
6 files changed, 60 insertions, 32 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 400ed0a48ce..27f9c183b8e 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1078,10 +1078,6 @@ a.test-arrow:hover{ text-decoration: none; } -.section-header a { - color: inherit; -} - .code-attribute { font-weight: 300; } diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 91ede47c156..85fb34b3959 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -214,18 +214,23 @@ nav.main .separator { border: 1px solid #5c6773; } a { + color: #39AFD7; +} +a.srclink, +a#toggle-all-docs, +#source-sidebar a, +pre.rust a, +.sidebar a, +.in-band a { color: #c5c5c5; } +.search-results a { + color: #0096cf; +} body.source .example-wrap pre.rust a { background: #333; } -.docblock:not(.item-decl) a:not(.srclink):not(.test-arrow), -.docblock-short a:not(.srclink):not(.test-arrow), .item-info a, -#help a { - color: #39AFD7; -} - details.rustdoc-toggle > summary.hideme > span, details.rustdoc-toggle > summary::before, details.undocumented > summary::before { diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 74a4fe45a3d..5a6c08bafd2 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -174,22 +174,27 @@ nav.main .current { nav.main .separator { border-color: #eee; } + a { - color: #ddd; + color: #D2991D; } -body.source .example-wrap pre.rust a { - background: #333; +a.srclink, +a#toggle-all-docs, +#source-sidebar a, +pre.rust a, +.sidebar a, +.in-band a { + color: #ddd; } - -.docblock:not(.item-decl) a:not(.srclink):not(.test-arrow), -.docblock-short a:not(.srclink):not(.test-arrow), .item-info a, -#help a { - color: #D2991D; +.search-results a { + color: #ddd; } - a.test-arrow { color: #dedede; } +body.source .example-wrap pre.rust a { + background: #333; +} details.rustdoc-toggle > summary.hideme > span, details.rustdoc-toggle > summary::before, diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 6df137e3914..05f12fc365d 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -169,22 +169,27 @@ nav.main .current { nav.main .separator { border: 1px solid #000; } + a { - color: #000; + color: #3873AD; } -body.source .example-wrap pre.rust a { - background: #eee; +a.srclink, +a#toggle-all-docs, +#source-sidebar a, +pre.rust a, +.sidebar a, +.in-band a { + color: #000; } - -.docblock:not(.item-decl) a:not(.srclink):not(.test-arrow), -.docblock-short a:not(.srclink):not(.test-arrow), .item-info a, -#help a { - color: #3873AD; +.search-results a { + color: initial; } - a.test-arrow { color: #f5f5f5; } +body.source .example-wrap pre.rust a { + background: #eee; +} details.rustdoc-toggle > summary.hideme > span, details.rustdoc-toggle > summary::before, diff --git a/src/test/rustdoc-gui/anchors.goml b/src/test/rustdoc-gui/anchors.goml new file mode 100644 index 00000000000..6953009604c --- /dev/null +++ b/src/test/rustdoc-gui/anchors.goml @@ -0,0 +1,17 @@ +goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html + +// Set the theme to light. +local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} +// We reload the page so the local storage settings are being used. +reload: + +assert-css: ("#toggle-all-docs", {"color": "rgba(0, 0, 0, 0)"}) +assert-css: (".fqn .in-band a:nth-of-type(1)", {"color": "rgba(0, 0, 0, 0)"}) +assert-css: (".fqn .in-band a:nth-of-type(2)", {"color": "rgba(0, 0, 0, 0)"}) +assert-css: (".srclink", {"color": "rgba(0, 0, 0, 0)"}) +assert-css: (".srclink", {"color": "rgba(0, 0, 0, 0)"}) + +assert-css: ("#top-doc-prose-title", {"color": "rgba(0, 0, 0, 0)"}) + +assert-css: (".sidebar a", {"color": "rgba(0, 0, 0, 0)"}) +assert-css: (".in-band a", {"color": "rgba(0, 0, 0, 0)"}) diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js index b598c63f52a..0d6a2605d4f 100644 --- a/src/tools/rustdoc-gui/tester.js +++ b/src/tools/rustdoc-gui/tester.js @@ -194,7 +194,7 @@ async function main(argv) { .then(out => { const [output, nb_failures] = out; results[nb_failures === 0 ? "successful" : "failed"].push({ - file_name: file_name, + file_name: testPath, output: output, }); if (nb_failures > 0) { @@ -206,7 +206,7 @@ async function main(argv) { }) .catch(err => { results.errored.push({ - file_name: file_name, + file_name: testPath + file_name, output: err, }); status_bar.erroneous(); @@ -239,7 +239,7 @@ async function main(argv) { console.log(""); results.failed.sort(by_filename); results.failed.forEach(r => { - console.log(r.output); + console.log(r.file_name, r.output); }); } if (results.errored.length > 0) { @@ -247,7 +247,7 @@ async function main(argv) { // print run errors on the bottom so developers see them better results.errored.sort(by_filename); results.errored.forEach(r => { - console.error(r.output); + console.error(r.file_name, r.output); }); } |
