diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css
index 8dd7b2b3edc40..dab6d655c6a87 100644
--- a/src/librustdoc/html/static/css/themes/ayu.css
+++ b/src/librustdoc/html/static/css/themes/ayu.css
@@ -216,6 +216,9 @@ nav.main .separator {
a {
color: #c5c5c5;
}
+body.source .example-wrap pre.rust a {
+ background: #c5c5c5;
+}
.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,
diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css
index c26122e4bffb5..d9348be6994e2 100644
--- a/src/librustdoc/html/static/css/themes/dark.css
+++ b/src/librustdoc/html/static/css/themes/dark.css
@@ -177,6 +177,9 @@ nav.main .separator {
a {
color: #ddd;
}
+body.source .example-wrap pre.rust a {
+ background: #333;
+}
.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,
diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css
index bc18a72450896..0ffe5929ea593 100644
--- a/src/librustdoc/html/static/css/themes/light.css
+++ b/src/librustdoc/html/static/css/themes/light.css
@@ -172,6 +172,9 @@ nav.main .separator {
a {
color: #000;
}
+body.source .example-wrap pre.rust a {
+ background: #eee;
+}
.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
.docblock-short a:not(.srclink):not(.test-arrow), .item-info a,