Skip to content

Commit f333436

Browse files
authored
Rollup merge of rust-lang#102547 - GuillaumeGomez:migrate-css-theme-search-result, r=notriddle,jsha
Migrate CSS theme for search results Part of rust-lang#98460. Just like rust-lang#102237, I unified theme to how the `ayu` handles this one: only one color for the background when search results are focused or hovered. You can test it [here](https://rustdoc.crud.net/imperio/migrate-css-theme-search-result/lib2/index.html?search=coo). cc `@jsha` r? `@notriddle` PS: The repetition in GUI tests is getting out of hand so I opened GuillaumeGomez/browser-UI-test#363 to think about adding possibility to declare functions so we can greatly improve this.
2 parents a2126e7 + b8a63a6 commit f333436

File tree

5 files changed

+605
-128
lines changed

5 files changed

+605
-128
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,11 @@ so that we can apply CSS-filters to change the arrow color in themes */
970970
padding-right: 1em;
971971
}
972972

973+
.search-results a:hover,
974+
.search-results a:focus {
975+
background-color: var(--search-result-link-focus-background-color);
976+
}
977+
973978
.popover {
974979
font-size: 1rem;
975980
position: absolute;

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

+1-24
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Original by Dempfi (https://github.com/dempfi/ayu)
3737
--link-color: #39afd7;
3838
--sidebar-link-color: #53b1db;
3939
--sidebar-current-link-background-color: transparent;
40+
--search-result-link-focus-background-color: #3c3c3c;
4041
--stab-background-color: #314559;
4142
--stab-code-color: #e6e1cf;
4243
}
@@ -250,30 +251,6 @@ pre.rust .kw {}
250251
pre.rust .self, pre.rust .bool-val, pre.rust .prelude-val, pre.rust .attribute {}
251252
pre.rust .kw-2, pre.rust .prelude-ty {}
252253

253-
.search-results a:focus span {}
254-
a.result-trait:focus {}
255-
a.result-traitalias:focus {}
256-
a.result-mod:focus,
257-
a.result-externcrate:focus {}
258-
a.result-mod:focus {}
259-
a.result-externcrate:focus {}
260-
a.result-enum:focus {}
261-
a.result-struct:focus {}
262-
a.result-union:focus {}
263-
a.result-fn:focus,
264-
a.result-method:focus,
265-
a.result-tymethod:focus {}
266-
a.result-type:focus {}
267-
a.result-associatedtype:focus {}
268-
a.result-foreigntype:focus {}
269-
a.result-attr:focus,
270-
a.result-derive:focus,
271-
a.result-macro:focus {}
272-
a.result-constant:focus,
273-
a.result-static:focus {}
274-
a.result-primitive:focus {}
275-
a.result-keyword:focus {}
276-
277254
kbd {
278255
color: #c5c5c5;
279256
background-color: #314559;

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

+1-30
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
--link-color: #d2991d;
3333
--sidebar-link-color: #fdbf35;
3434
--sidebar-current-link-background-color: #444;
35+
--search-result-link-focus-background-color: #616161;
3536
--stab-background-color: #314559;
3637
--stab-code-color: #e6e1cf;
3738
}
@@ -58,36 +59,6 @@ input:focus + .slider {
5859
background-color: #0a042f !important;
5960
}
6061

61-
.search-results a:hover {
62-
background-color: #777;
63-
}
64-
65-
.search-results a:focus {
66-
color: #eee !important;
67-
background-color: #616161;
68-
}
69-
.search-results a:focus span { color: #eee !important; }
70-
a.result-trait:focus { background-color: #013191; }
71-
a.result-traitalias:focus { background-color: #013191; }
72-
a.result-mod:focus,
73-
a.result-externcrate:focus { background-color: #884719; }
74-
a.result-enum:focus { background-color: #194e9f; }
75-
a.result-struct:focus { background-color: #194e9f; }
76-
a.result-union:focus { background-color: #194e9f; }
77-
a.result-fn:focus,
78-
a.result-method:focus,
79-
a.result-tymethod:focus { background-color: #4950ed; }
80-
a.result-type:focus { background-color: #194e9f; }
81-
a.result-associatedtype:focus { background-color: #884719; }
82-
a.result-foreigntype:focus { background-color: #194e9f; }
83-
a.result-attr:focus,
84-
a.result-derive:focus,
85-
a.result-macro:focus { background-color: #217d1c; }
86-
a.result-constant:focus,
87-
a.result-static:focus { background-color: #884719; }
88-
a.result-primitive:focus { background-color: #194e9f; }
89-
a.result-keyword:focus { background-color: #884719; }
90-
9162
.content .item-info::before { color: #ccc; }
9263

9364
pre.rust .comment { color: #8d8d8b; }

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

+1-30
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
--link-color: #3873ad;
3333
--sidebar-link-color: #356da4;
3434
--sidebar-current-link-background-color: #fff;
35+
--search-result-link-focus-background-color: #ccc;
3536
--stab-background-color: #fff5d6;
3637
--stab-code-color: #000;
3738
}
@@ -57,36 +58,6 @@ input:focus + .slider {
5758
background-color: #FDFFD3 !important;
5859
}
5960

60-
.search-results a:hover {
61-
background-color: #ddd;
62-
}
63-
64-
.search-results a:focus {
65-
color: #000 !important;
66-
background-color: #ccc;
67-
}
68-
.search-results a:focus span { color: #000 !important; }
69-
a.result-trait:focus { background-color: #c7b6ff; }
70-
a.result-traitalias:focus { background-color: #c7b6ff; }
71-
a.result-mod:focus,
72-
a.result-externcrate:focus { background-color: #afc6e4; }
73-
a.result-enum:focus { background-color: #e7b1a0; }
74-
a.result-struct:focus { background-color: #e7b1a0; }
75-
a.result-union:focus { background-color: #e7b1a0; }
76-
a.result-fn:focus,
77-
a.result-method:focus,
78-
a.result-tymethod:focus { background-color: #c6afb3; }
79-
a.result-type:focus { background-color: #e7b1a0; }
80-
a.result-associatedtype:focus { background-color: #afc6e4; }
81-
a.result-foreigntype:focus { background-color: #e7b1a0; }
82-
a.result-attr:focus,
83-
a.result-derive:focus,
84-
a.result-macro:focus { background-color: #8ce488; }
85-
a.result-constant:focus,
86-
a.result-static:focus { background-color: #afc6e4; }
87-
a.result-primitive:focus { background-color: #e7b1a0; }
88-
a.result-keyword:focus { background-color: #afc6e4; }
89-
9061
.content .item-info::before { color: #ccc; }
9162

9263
body.source .example-wrap pre.rust a {

0 commit comments

Comments
 (0)