Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustdoc: search: color item type and reduce size to avoid clashing #112720

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,10 @@ so that we can apply CSS-filters to change the arrow color in themes */
.search-results .result-name .grey {
color: var(--search-results-grey-color);
}
.search-results .result-name .typename {
color: var(--search-results-grey-color);
font-size: 0.875rem;
}

.popover {
position: absolute;
Expand Down
4 changes: 3 additions & 1 deletion src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,9 @@ function initSearch(rawSearchIndex) {

resultName.insertAdjacentHTML(
"beforeend",
`${typeName} ${item.displayPath}<span class="${type}">${name}</span>`);
`<span class="typename">${typeName}</span>`
+ ` ${item.displayPath}<span class="${type}">${name}</span>`
);
link.appendChild(resultName);

const description = document.createElement("div");
Expand Down
6 changes: 6 additions & 0 deletions tests/rustdoc-gui/search-result-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ define-function: (
".result-" + |result_kind| + ":focus ." + |result_kind|,
{"color": |hover_color|},
)
// color of the typename (struct, module, method, ...) before search results
assert-css: (
".result-name .typename",
{"color": "#888"},
ALL,
)
},
)

Expand Down