Rollup merge of #104666 - GuillaumeGomez:migrate-alias-search-result, r=notriddle

Migrate alias search result to CSS variables

r? `@notriddle`
This commit is contained in:
Matthias Krüger 2022-11-22 00:01:11 +01:00 committed by GitHub
commit 96d0b7f159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 41 deletions

View file

@ -907,6 +907,13 @@ so that we can apply CSS-filters to change the arrow color in themes */
background-color: var(--search-result-link-focus-background-color);
}
.search-results .result-name span.alias {
color: var(--search-results-alias-color);
}
.search-results .result-name span.grey {
color: var(--search-results-grey-color);
}
.popover {
position: absolute;
right: 0;

View file

@ -41,9 +41,11 @@ Original by Dempfi (https://github.com/dempfi/ayu)
--sidebar-current-link-background-color: transparent;
--search-result-link-focus-background-color: #3c3c3c;
--search-result-border-color: #aaa3;
--search-color: #fff;
--search-results-alias-color: #c5c5c5;
--search-results-grey-color: #999;
--stab-background-color: #314559;
--stab-code-color: #e6e1cf;
--search-color: #fff;
--code-highlight-kw-color: #ff7733;
--code-highlight-kw-2-color: #ff7733;
--code-highlight-lifetime-color: #ff7733;
@ -202,13 +204,6 @@ pre.rust .kw-2, pre.rust .prelude-ty {}
filter: invert(100);
}
.search-results .result-name span.alias {
color: #c5c5c5;
}
.search-results .result-name span.grey {
color: #999;
}
#source-sidebar > .title {
color: #fff;
}

View file

@ -36,9 +36,11 @@
--sidebar-current-link-background-color: #444;
--search-result-link-focus-background-color: #616161;
--search-result-border-color: #aaa3;
--search-color: #111;
--search-results-alias-color: #fff;
--search-results-grey-color: #ccc;
--stab-background-color: #314559;
--stab-code-color: #e6e1cf;
--search-color: #111;
--code-highlight-kw-color: #ab8ac1;
--code-highlight-kw-2-color: #769acb;
--code-highlight-lifetime-color: #d97f26;
@ -103,13 +105,6 @@ details.rustdoc-toggle > summary::before {
color: #888;
}
.search-results .result-name span.alias {
color: #fff;
}
.search-results .result-name span.grey {
color: #ccc;
}
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
background-color: #444;

View file

@ -36,9 +36,11 @@
--sidebar-current-link-background-color: #fff;
--search-result-link-focus-background-color: #ccc;
--search-result-border-color: #aaa3;
--search-color: #000;
--search-results-alias-color: #000;
--search-results-grey-color: #999;
--stab-background-color: #fff5d6;
--stab-code-color: #000;
--search-color: #000;
--code-highlight-kw-color: #8959a8;
--code-highlight-kw-2-color: #4271ae;
--code-highlight-lifetime-color: #b76514;
@ -96,13 +98,6 @@ body.source .example-wrap pre.rust a {
color: #888;
}
.search-results .result-name span.alias {
color: #000;
}
.search-results .result-name span.grey {
color: #999;
}
#source-sidebar div.files > a:hover, details.dir-entry summary:hover,
#source-sidebar div.files > a:focus, details.dir-entry summary:focus {
background-color: #E0E0E0;

View file

@ -366,23 +366,42 @@ assert-css: (
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
)
// Check the alias more specifically in the dark theme.
// Check the alias.
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
// this test is running on.
local-storage: {
"rustdoc-theme": "dark",
"rustdoc-use-system-theme": "false",
}
// If the text isn't displayed, the browser doesn't compute color style correctly...
show-text: true
// We reload the page so the local storage settings are being used.
reload:
write: (".search-input", "thisisanalias")
// To be SURE that the search will be run.
press-key: 'Enter'
// Waiting for the search results to appear...
wait-for: "#titles"
// Checking that the colors for the alias element are the ones expected.
assert-css: (".result-name > .alias", {"color": "rgb(255, 255, 255)"})
assert-css: (".result-name > .alias > .grey", {"color": "rgb(204, 204, 204)"})
define-function: (
"check-alias",
(theme, alias, grey),
[
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("write", (".search-input", "thisisanalias")),
// To be SURE that the search will be run.
("press-key", 'Enter'),
// Waiting for the search results to appear...
("wait-for", "#titles"),
// Checking that the colors for the alias element are the ones expected.
("assert-css", (".result-name > .alias", {"color": |alias|})),
("assert-css", (".result-name > .alias > .grey", {"color": |grey|})),
// Leave the search results to prevent reloading with an already filled search input.
("press-key", "Escape"),
],
)
call-function: ("check-alias", {
"theme": "ayu",
"alias": "rgb(197, 197, 197)",
"grey": "rgb(153, 153, 153)",
})
call-function: ("check-alias", {
"theme": "dark",
"alias": "rgb(255, 255, 255)",
"grey": "rgb(204, 204, 204)",
})
call-function: ("check-alias", {
"theme": "light",
"alias": "rgb(0, 0, 0)",
"grey": "rgb(153, 153, 153)",
})