diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css
index 4beca56b66a62..c644b8413cc0f 100644
--- a/src/librustdoc/html/static/css/themes/ayu.css
+++ b/src/librustdoc/html/static/css/themes/ayu.css
@@ -160,10 +160,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..8141e99c52a5d 100644
--- a/src/librustdoc/html/static/css/themes/dark.css
+++ b/src/librustdoc/html/static/css/themes/dark.css
@@ -82,10 +82,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..6e3d7568ffb72 100644
--- a/src/librustdoc/html/static/css/themes/light.css
+++ b/src/librustdoc/html/static/css/themes/light.css
@@ -69,17 +69,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;
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..b88be32c94a4b
--- /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(210, 153, 29)",
+ "link_hover": "rgb(210, 153, 29)",
+})
+call-function: ("check-no-result", {
+ "theme": "light",
+ "link": "rgb(56, 115, 173)",
+ "link_hover": "rgb(56, 115, 173)",
+})