Skip to content

Commit a318824

Browse files
Rollup merge of #112720 - poliorcetics:rustdoc-item-type-color-same-as-item-color, r=notriddle,GuillaumeGomez
Rustdoc: search: color item type and reduce size to avoid clashing - rustdoc: search: color item type same as item - rustdoc: search: reduce item type size to 0.875rem to avoid clashing with path and item
2 parents 816b659 + c3cdf85 commit a318824

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
890890
.search-results .result-name .grey {
891891
color: var(--search-results-grey-color);
892892
}
893+
.search-results .result-name .typename {
894+
color: var(--search-results-grey-color);
895+
font-size: 0.875rem;
896+
}
893897

894898
.popover {
895899
position: absolute;

src/librustdoc/html/static/js/search.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,9 @@ function initSearch(rawSearchIndex) {
20242024

20252025
resultName.insertAdjacentHTML(
20262026
"beforeend",
2027-
`${typeName} ${item.displayPath}<span class="${type}">${name}</span>`);
2027+
`<span class="typename">${typeName}</span>`
2028+
+ ` ${item.displayPath}<span class="${type}">${name}</span>`
2029+
);
20282030
link.appendChild(resultName);
20292031

20302032
const description = document.createElement("div");

tests/rustdoc-gui/search-result-color.goml

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ define-function: (
2828
".result-" + |result_kind| + ":focus ." + |result_kind|,
2929
{"color": |hover_color|},
3030
)
31+
// color of the typename (struct, module, method, ...) before search results
32+
assert-css: (
33+
".result-name .typename",
34+
{"color": "#888"},
35+
ALL,
36+
)
3137
},
3238
)
3339

0 commit comments

Comments
 (0)