Skip to content

Commit 786ec7c

Browse files
Migrate source code elements style to CSS variables
1 parent 4e0d0d7 commit 786ec7c

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,13 @@ a.test-arrow:hover {
13451345
border-bottom: 1px solid var(--border-color);
13461346
margin-bottom: 6px;
13471347
}
1348+
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
1349+
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
1350+
background-color: var(--source-sidebar-background-hover);
1351+
}
1352+
#source-sidebar div.files > a.selected {
1353+
background-color: var(--source-sidebar-background-selected);
1354+
}
13481355
#sidebar-toggle > button {
13491356
font-size: inherit;
13501357
font-weight: bold;

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

+3-5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
8484
--crate-search-div-hover-filter: invert(98%) sepia(12%) saturate(81%) hue-rotate(343deg)
8585
brightness(113%) contrast(76%);
8686
--crate-search-hover-border: #e0e0e0;
87+
--source-sidebar-background-selected: #14191f;
88+
--source-sidebar-background-hover: #14191f;
8789
}
8890

8991
h1, h2, h3, h4 {
@@ -208,12 +210,8 @@ pre.rust .kw-2, pre.rust .prelude-ty {}
208210
color: #fff;
209211
}
210212
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
211-
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
212-
background-color: #14191f;
213-
color: #ffb44c;
214-
}
213+
#source-sidebar div.files > a:focus, details.dir-entry summary:focus,
215214
#source-sidebar div.files > a.selected {
216-
background-color: #14191f;
217215
color: #ffb44c;
218216
}
219217

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

+2-8
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@
7979
--crate-search-div-hover-filter: invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg)
8080
brightness(100%) contrast(91%);
8181
--crate-search-hover-border: #2196f3;
82+
--source-sidebar-background-selected: #333;
83+
--source-sidebar-background-hover: #444;
8284
}
8385

8486
.content .item-info::before { color: #ccc; }
@@ -105,14 +107,6 @@ details.rustdoc-toggle > summary::before {
105107
color: #888;
106108
}
107109

108-
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
109-
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
110-
background-color: #444;
111-
}
112-
#source-sidebar div.files > a.selected {
113-
background-color: #333;
114-
}
115-
116110
.scraped-example-list .scrape-help {
117111
border-color: #aaa;
118112
color: #eee;

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

+2-7
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
--crate-search-div-hover-filter: invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg)
7777
brightness(96%) contrast(93%);
7878
--crate-search-hover-border: #717171;
79+
--source-sidebar-background-selected: #fff;
80+
--source-sidebar-background-hover: #e0e0e0;
7981
}
8082

8183
.content .item-info::before { color: #ccc; }
@@ -98,13 +100,6 @@ body.source .example-wrap pre.rust a {
98100
color: #888;
99101
}
100102

101-
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
102-
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
103-
background-color: #E0E0E0;
104-
}
105-
#source-sidebar div.files > a.selected {
106-
background-color: #fff;
107-
}
108103
.scraped-example-list .scrape-help {
109104
border-color: #555;
110105
color: #333;

0 commit comments

Comments
 (0)