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 results color on hover for ayu theme #100804

Merged
merged 2 commits into from
Aug 31, 2022
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
7 changes: 4 additions & 3 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ pre, .rustdoc.source .example-wrap {
}

.search-results a:hover {
background-color: #777;
color: #fff !important;
background-color: #3c3c3c;
}

.search-results a:focus {
color: #000 !important;
background-color: #c6afb3;
color: #fff !important;
background-color: #3c3c3c;
}
.search-results a {
color: #0096cf;
Expand Down
51 changes: 51 additions & 0 deletions src/test/rustdoc-gui/search-result-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ assert-css: (
{"color": "rgb(120, 135, 151)"},
)

// Checking the `<a>` container.
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
{"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
)

// Checking color and background on hover.
move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
{"color": "rgb(255, 255, 255)"},
)
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
{"color": "rgb(255, 255, 255)", "background-color": "rgb(60, 60, 60)"},
)

// Dark theme
local-storage: {
"rustdoc-theme": "dark",
Expand All @@ -54,6 +71,23 @@ assert-css: (
{"color": "rgb(221, 221, 221)"},
)

// Checking the `<a>` container.
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
)

// Checking color and background on hover.
move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
{"color": "rgb(221, 221, 221)"},
)
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(119, 119, 119)"},
)

// Light theme
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:
Expand All @@ -75,6 +109,23 @@ assert-css: (
{"color": "rgb(0, 0, 0)"},
)

// Checking the `<a>` container.
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
)

// Checking color and background on hover.
move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
{"color": "rgb(0, 0, 0)"},
)
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
{"color": "rgb(0, 0, 0)", "background-color": "rgb(221, 221, 221)"},
)

// Check the alias more specifically in the dark theme.
goto: file://|DOC_PATH|/test_docs/index.html
// We set the theme so we're sure that the correct values will be used, whatever the computer
Expand Down