From 18c4fa66cbced6d1f08973661bc5927e34f22ea5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 10 Nov 2022 18:16:22 +0100 Subject: [PATCH 1/3] Migrate no result page link color to CSS variables --- src/librustdoc/html/static/css/rustdoc.css | 4 ++++ src/librustdoc/html/static/css/themes/ayu.css | 5 +---- src/librustdoc/html/static/css/themes/dark.css | 5 +---- src/librustdoc/html/static/css/themes/light.css | 6 +----- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 6a068a3d243d9..2b3c37d5c9028 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1331,6 +1331,10 @@ h3.variant { display: none; } +.search-failed a { + color: var(--search-failed-link-color); +} + .search-failed.active { display: block; } diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 4beca56b66a62..bd74ae303e211 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -39,6 +39,7 @@ Original by Dempfi (https://github.com/dempfi/ayu) --sidebar-current-link-background-color: transparent; --search-result-link-focus-background-color: #3c3c3c; --search-result-border-color: #aaa3; + --search-failed-link-color: #39afd7; --stab-background-color: #314559; --stab-code-color: #e6e1cf; --search-color: #fff; @@ -160,10 +161,6 @@ details.rustdoc-toggle > summary::before { color: #788797; } -.search-failed a { - color: #39AFD7; -} - .tooltip::after { background-color: #314559; color: #c5c5c5; diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 9b0bd8c8f0a4b..d8a06dab3ea1e 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -34,6 +34,7 @@ --sidebar-current-link-background-color: #444; --search-result-link-focus-background-color: #616161; --search-result-border-color: #aaa3; + --search-failed-link-color: #0089ff; --stab-background-color: #314559; --stab-code-color: #e6e1cf; --search-color: #111; @@ -82,10 +83,6 @@ details.rustdoc-toggle > summary::before { filter: invert(100%); } -.search-failed a { - color: #0089ff; -} - .tooltip::after { background-color: #000; color: #fff; diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index f12fb61d879b2..19d6b53734f1c 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -34,6 +34,7 @@ --sidebar-current-link-background-color: #fff; --search-result-link-focus-background-color: #ccc; --search-result-border-color: #aaa3; + --search-failed-link-color: #3873ad; --stab-background-color: #fff5d6; --stab-code-color: #000; --search-color: #000; @@ -69,17 +70,12 @@ --crate-search-hover-border: #717171; } - .content .item-info::before { color: #ccc; } body.source .example-wrap pre.rust a { background: #eee; } -.search-failed a { - color: #3873AD; -} - .tooltip::after { background-color: #000; color: #fff; From 7e79619e7a0ea3c5deac36fdbb4620c30d63f131 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 10 Nov 2022 18:51:08 +0100 Subject: [PATCH 2/3] Add GUI test for "no result found" links --- src/test/rustdoc-gui/search-no-result.goml | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/test/rustdoc-gui/search-no-result.goml diff --git a/src/test/rustdoc-gui/search-no-result.goml b/src/test/rustdoc-gui/search-no-result.goml new file mode 100644 index 0000000000000..70704a27d7c31 --- /dev/null +++ b/src/test/rustdoc-gui/search-no-result.goml @@ -0,0 +1,36 @@ +// The goal of this test is to check the color of the "no result" links. +goto: "file://" + |DOC_PATH| + "/lib2/index.html?search=sdkfskjfsdks" +show-text: true + +define-function: ( + "check-no-result", + (theme, link, link_hover), + [ + // Changing theme. + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + ("reload"), + ("wait-for", "#results"), + ("assert", ".search-failed.active"), + ("assert-css", ("#results a", {"color": |link|}, ALL)), + ("move-cursor-to", "#results a"), + ("assert-css", ("#results a:hover", {"color": |link_hover|})), + // Moving the cursor to some other place to not create issues with next function run. + ("move-cursor-to", ".search-input"), + ] +) + +call-function: ("check-no-result", { + "theme": "ayu", + "link": "rgb(57, 175, 215)", + "link_hover": "rgb(57, 175, 215)", +}) +call-function: ("check-no-result", { + "theme": "dark", + "link": "rgb(0, 137, 255)", + "link_hover": "rgb(0, 137, 255)", +}) +call-function: ("check-no-result", { + "theme": "light", + "link": "rgb(56, 115, 173)", + "link_hover": "rgb(56, 115, 173)", +}) From ee7381266a40276c7697a2f6bedc0bb9f8debd4b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 11 Nov 2022 20:39:20 +0100 Subject: [PATCH 3/3] Use same color for links in no result search --- src/librustdoc/html/static/css/rustdoc.css | 4 ---- src/librustdoc/html/static/css/themes/ayu.css | 1 - src/librustdoc/html/static/css/themes/dark.css | 1 - src/librustdoc/html/static/css/themes/light.css | 1 - src/test/rustdoc-gui/search-no-result.goml | 4 ++-- 5 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 2b3c37d5c9028..6a068a3d243d9 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1331,10 +1331,6 @@ h3.variant { display: none; } -.search-failed a { - color: var(--search-failed-link-color); -} - .search-failed.active { display: block; } diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index bd74ae303e211..c644b8413cc0f 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -39,7 +39,6 @@ Original by Dempfi (https://github.com/dempfi/ayu) --sidebar-current-link-background-color: transparent; --search-result-link-focus-background-color: #3c3c3c; --search-result-border-color: #aaa3; - --search-failed-link-color: #39afd7; --stab-background-color: #314559; --stab-code-color: #e6e1cf; --search-color: #fff; diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index d8a06dab3ea1e..8141e99c52a5d 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -34,7 +34,6 @@ --sidebar-current-link-background-color: #444; --search-result-link-focus-background-color: #616161; --search-result-border-color: #aaa3; - --search-failed-link-color: #0089ff; --stab-background-color: #314559; --stab-code-color: #e6e1cf; --search-color: #111; diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 19d6b53734f1c..6e3d7568ffb72 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -34,7 +34,6 @@ --sidebar-current-link-background-color: #fff; --search-result-link-focus-background-color: #ccc; --search-result-border-color: #aaa3; - --search-failed-link-color: #3873ad; --stab-background-color: #fff5d6; --stab-code-color: #000; --search-color: #000; diff --git a/src/test/rustdoc-gui/search-no-result.goml b/src/test/rustdoc-gui/search-no-result.goml index 70704a27d7c31..b88be32c94a4b 100644 --- a/src/test/rustdoc-gui/search-no-result.goml +++ b/src/test/rustdoc-gui/search-no-result.goml @@ -26,8 +26,8 @@ call-function: ("check-no-result", { }) call-function: ("check-no-result", { "theme": "dark", - "link": "rgb(0, 137, 255)", - "link_hover": "rgb(0, 137, 255)", + "link": "rgb(210, 153, 29)", + "link_hover": "rgb(210, 153, 29)", }) call-function: ("check-no-result", { "theme": "light",