Skip to content

Commit fc488d4

Browse files
authored
Rollup merge of #87085 - GuillaumeGomez:search-result-colors, r=notriddle
Search result colors Part of #87072 (fixes the first and fourth regressions and add tests to prevent it from happening again). cc ````@Nemo157```` r? ````@camelid````
2 parents 3e1c75c + b8264a8 commit fc488d4

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pre, .rustdoc.source .example-wrap {
161161
.search-results a {
162162
color: #0096cf;
163163
}
164-
.search-results a span.desc {
164+
.search-results a div.desc {
165165
color: #c5c5c5;
166166
}
167167

@@ -286,7 +286,7 @@ details.undocumented > summary::before {
286286
color: grey;
287287
}
288288

289-
tr.result span.primitive::after, tr.result span.keyword::after {
289+
.result-name .primitive > i, .result-name .keyword > i {
290290
color: #788797;
291291
}
292292

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ details.undocumented > summary::before {
247247
color: grey;
248248
}
249249

250-
tr.result span.primitive::after, tr.result span.keyword::after {
250+
.result-name .primitive > i, .result-name .keyword > i {
251251
color: #ddd;
252252
}
253253

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ details.undocumented > summary::before {
237237
color: grey;
238238
}
239239

240-
tr.result span.primitive::after, tr.result span.keyword::after {
240+
.result-name .primitive > i, .result-name .keyword > i {
241241
color: black;
242242
}
243243

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// The goal of this test is to ensure the color of the text is the one expected.
2+
goto: file://|DOC_PATH|/test_docs/index.html?search=coo
3+
4+
// This is needed so that the text color is computed.
5+
show-text: true
6+
7+
// Ayu theme
8+
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
9+
reload:
10+
11+
// Waiting for the search results to appear...
12+
wait-for: "#titles"
13+
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(197, 197, 197)"})
14+
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 150, 207)"})
15+
16+
// Checking the color for "keyword".
17+
assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(120, 135, 151)"})
18+
19+
// Dark theme
20+
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
21+
reload:
22+
23+
// Waiting for the search results to appear...
24+
wait-for: "#titles"
25+
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(221, 221, 221)"})
26+
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(221, 221, 221)"})
27+
28+
// Checking the color for "keyword".
29+
assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(221, 221, 221)"})
30+
31+
// Light theme
32+
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
33+
reload:
34+
35+
// Waiting for the search results to appear...
36+
wait-for: "#titles"
37+
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(0, 0, 0)"})
38+
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 0, 0)"})
39+
40+
// Checking the color for "keyword".
41+
assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(0, 0, 0)"})

src/test/rustdoc-gui/src/test_docs/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ pub enum AnEnum {
101101
}
102102

103103
#[doc(keyword = "CookieMonster")]
104+
/// Some keyword.
104105
pub mod keyword {}
105106

106107
/// Just some type alias.

0 commit comments

Comments
 (0)