From 749cd8f9af63a5a96c0fa362f801ad8c04ecea8a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 14 Jul 2021 14:47:54 +0200 Subject: [PATCH 1/2] Fix color for which are not in doc blocks --- src/librustdoc/html/static/css/themes/ayu.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 171d06c0a3667..5aee92967a594 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -34,7 +34,7 @@ h4 { background: rgba(0, 0, 0, 0); } -code { +.docblock code { color: #ffb454; } h3 > code, h4 > code, h5 > code { From 46b4b377b8d3f09f63ec8b5bede229cd09d6aa64 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 14 Jul 2021 15:00:12 +0200 Subject: [PATCH 2/2] Add GUI test to check ayu colors --- src/test/rustdoc-gui/ayu-code-tag-colors.goml | 13 +++++++++++++ src/test/rustdoc-gui/src/test_docs/lib.rs | 1 + 2 files changed, 14 insertions(+) create mode 100644 src/test/rustdoc-gui/ayu-code-tag-colors.goml diff --git a/src/test/rustdoc-gui/ayu-code-tag-colors.goml b/src/test/rustdoc-gui/ayu-code-tag-colors.goml new file mode 100644 index 0000000000000..50af36fa3d641 --- /dev/null +++ b/src/test/rustdoc-gui/ayu-code-tag-colors.goml @@ -0,0 +1,13 @@ +// The ayu theme has a different color for the "" tags in the doc blocks. We need to +// check that the rule isn't applied on other "" elements. +goto: file://|DOC_PATH|/test_docs/enum.AnEnum.html +// We need to show the text, otherwise the colors aren't "computed" by the web browser. +show-text: true +// We set the theme to ayu. +local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"} +// We reload to get the text appearing and the theme applied. +reload: + +assert-css: (".docblock code", {"color": "rgb(255, 180, 84)"}, ALL) +// It includes variants and the "titles" as well (for example: "impl RefUnwindSafe for AnEnum"). +assert-css: ("div:not(.docblock) > code", {"color": "rgb(197, 197, 197)"}, ALL) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index 3e753cb4de8b1..f5eeac53ddc90 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -96,6 +96,7 @@ pub fn check_list_code_block() {} #[doc(cfg(unix))] pub fn replaced_function() {} +/// Some doc with `code`! pub enum AnEnum { WithVariants { and: usize, sub: usize, variants: usize }, }