Skip to content

Commit 384059a

Browse files
Migrate :target rules to use CSS variables
1 parent 01a6f30 commit 384059a

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

src/librustdoc/html/static/css/rustdoc.css

+2
Original file line numberDiff line numberDiff line change
@@ -1269,6 +1269,8 @@ h3.variant {
12691269

12701270
:target {
12711271
padding-right: 3px;
1272+
background-color: var(--target-background-color);
1273+
border-right: 3px solid var(--target-border-color);
12721274
}
12731275

12741276
.notable-traits-tooltip {

src/librustdoc/html/static/css/themes/ayu.css

+2-5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
6363
--test-arrow-background-color: rgba(57, 175, 215, 0.09);
6464
--test-arrow-hover-color: #c5c5c5;
6565
--test-arrow-hover-background-color: rgba(57, 175, 215, 0.368);
66+
--target-background-color: rgba(255, 236, 164, 0.06);
67+
--target-border-color: rgba(255, 180, 76, 0.85);
6668
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
6769
drop-shadow(0 1px 0 #fff)
6870
drop-shadow(-1px 0 0 #fff)
@@ -168,11 +170,6 @@ details.rustdoc-toggle > summary::before {
168170
color: #788797;
169171
}
170172

171-
:target {
172-
background: rgba(255, 236, 164, 0.06);
173-
border-right: 3px solid rgba(255, 180, 76, 0.85);
174-
}
175-
176173
.search-failed a {
177174
color: #39AFD7;
178175
}

src/librustdoc/html/static/css/themes/dark.css

+2-5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
--test-arrow-background-color: rgba(78, 139, 202, 0.2);
5959
--test-arrow-hover-color: #dedede;
6060
--test-arrow-hover-background-color: #4e8bca;
61+
--target-background-color: #494a3d;
62+
--target-border-color: #bb7410;
6163
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
6264
drop-shadow(0 1px 0 #fff)
6365
drop-shadow(-1px 0 0 #fff)
@@ -90,11 +92,6 @@ details.rustdoc-toggle > summary::before {
9092
filter: invert(100%);
9193
}
9294

93-
:target {
94-
background-color: #494a3d;
95-
border-right: 3px solid #bb7410;
96-
}
97-
9895
.search-failed a {
9996
color: #0089ff;
10097
}

src/librustdoc/html/static/css/themes/light.css

+2-5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
--test-arrow-background-color: rgba(78, 139, 202, 0.2);
5959
--test-arrow-hover-color: #f5f5f5;
6060
--test-arrow-hover-background-color: #4e8bca;
61+
--target-background-color: #fdFfd3;
62+
--target-border-color: #ad7c37;
6163
--rust-logo-filter: initial;
6264
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
6365
--crate-search-div-filter: invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg)
@@ -83,11 +85,6 @@ body.source .example-wrap pre.rust a {
8385
background: #eee;
8486
}
8587

86-
:target {
87-
background: #FDFFD3;
88-
border-right: 3px solid #AD7C37;
89-
}
90-
9188
.search-failed a {
9289
color: #3873AD;
9390
}

0 commit comments

Comments
 (0)