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

Fix search result colors #87085

Merged
merged 4 commits into from
Jul 14, 2021
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: 2 additions & 2 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pre, .rustdoc.source .example-wrap {
.search-results a {
color: #0096cf;
}
.search-results a span.desc {
.search-results a div.desc {
color: #c5c5c5;
}

Expand Down Expand Up @@ -286,7 +286,7 @@ details.undocumented > summary::before {
color: grey;
}

tr.result span.primitive::after, tr.result span.keyword::after {
.result-name .primitive > i, .result-name .keyword > i {
color: #788797;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ details.undocumented > summary::before {
color: grey;
}

tr.result span.primitive::after, tr.result span.keyword::after {
.result-name .primitive > i, .result-name .keyword > i {
color: #ddd;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ details.undocumented > summary::before {
color: grey;
}

tr.result span.primitive::after, tr.result span.keyword::after {
.result-name .primitive > i, .result-name .keyword > i {
color: black;
}

Expand Down
41 changes: 41 additions & 0 deletions src/test/rustdoc-gui/search-result-color.goml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// The goal of this test is to ensure the color of the text is the one expected.
goto: file://|DOC_PATH|/test_docs/index.html?search=coo

// This is needed so that the text color is computed.
show-text: true

// Ayu theme
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
reload:

// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(197, 197, 197)"})
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 150, 207)"})

// Checking the color for "keyword".
assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(120, 135, 151)"})

// Dark theme
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
reload:

// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(221, 221, 221)"})
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(221, 221, 221)"})

// Checking the color for "keyword".
assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(221, 221, 221)"})

// Light theme
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:

// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(0, 0, 0)"})
assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 0, 0)"})

// Checking the color for "keyword".
assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(0, 0, 0)"})
1 change: 1 addition & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub enum AnEnum {
}

#[doc(keyword = "CookieMonster")]
/// Some keyword.
pub mod keyword {}

/// Just some type alias.
Expand Down