From 1a94b060894017055a3986fdb5603ffbbe8b9c89 Mon Sep 17 00:00:00 2001 From: "Alexis (Poliorcetics) Bourget" Date: Fri, 16 Jun 2023 23:18:57 +0200 Subject: [PATCH 1/2] rustdoc: js: change color and reduce size of typename in search result --- src/librustdoc/html/static/css/rustdoc.css | 4 ++++ src/librustdoc/html/static/js/search.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index b487cfa5c25..21c1eb631e0 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -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; diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 3059dac8207..452348dc865 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -2024,7 +2024,9 @@ function initSearch(rawSearchIndex) { resultName.insertAdjacentHTML( "beforeend", - `${typeName} ${item.displayPath}${name}`); + `${typeName}` + + ` ${item.displayPath}${name}` + ); link.appendChild(resultName); const description = document.createElement("div"); From c3cdf8542d8af35d45dedfa2d9eaccd968e69db7 Mon Sep 17 00:00:00 2001 From: "Alexis (Poliorcetics) Bourget" Date: Tue, 20 Jun 2023 08:28:56 +0200 Subject: [PATCH 2/2] tests: add test for color of item kind --- tests/rustdoc-gui/search-result-color.goml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml index c75e4141434..193a3eb3fd1 100644 --- a/tests/rustdoc-gui/search-result-color.goml +++ b/tests/rustdoc-gui/search-result-color.goml @@ -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, + ) }, )