Rollup merge of #104065 - GuillaumeGomez:css-migrate-logo-filter, r=notriddle

Migrate rust logo filter to CSS variables
This commit is contained in:
Yuki Okushi 2022-11-07 09:46:28 +09:00 committed by GitHub
commit fe6161a6a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 20 deletions

View file

@ -378,6 +378,10 @@ img {
object-fit: contain;
}
.rust-logo {
filter: var(--rust-logo-filter);
}
.sidebar, .mobile-topbar, .sidebar-menu-toggle {
background-color: var(--sidebar-background-color);
}

View file

@ -63,6 +63,10 @@ Original by Dempfi (https://github.com/dempfi/ayu)
--test-arrow-background-color: rgba(57, 175, 215, 0.09);
--test-arrow-hover-color: #c5c5c5;
--test-arrow-hover-background-color: rgba(57, 175, 215, 0.368);
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
drop-shadow(0 1px 0 #fff)
drop-shadow(-1px 0 0 #fff)
drop-shadow(0 -1px 0 #fff);
}
.slider {
@ -104,13 +108,6 @@ pre, .rustdoc.source .example-wrap {
color: #e6e1cf;
}
.rust-logo {
filter: drop-shadow(1px 0 0px #fff)
drop-shadow(0 1px 0 #fff)
drop-shadow(-1px 0 0 #fff)
drop-shadow(0 -1px 0 #fff);
}
.sidebar .current,
.sidebar a:hover {
color: #ffb44c;

View file

@ -58,6 +58,10 @@
--test-arrow-background-color: rgba(78, 139, 202, 0.2);
--test-arrow-hover-color: #dedede;
--test-arrow-hover-background-color: #4e8bca;
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
drop-shadow(0 1px 0 #fff)
drop-shadow(-1px 0 0 #fff)
drop-shadow(0 -1px 0 #fff);
}
.slider {
@ -70,13 +74,6 @@ input:focus + .slider {
box-shadow: 0 0 0 2px #0a84ff, 0 0 0 6px rgba(10, 132, 255, 0.3);
}
.rust-logo {
filter: drop-shadow(1px 0 0px #fff)
drop-shadow(0 1px 0 #fff)
drop-shadow(-1px 0 0 #fff)
drop-shadow(0 -1px 0 #fff)
}
.content .item-info::before { color: #ccc; }
body.source .example-wrap pre.rust a {

View file

@ -58,6 +58,7 @@
--test-arrow-background-color: rgba(78, 139, 202, 0.2);
--test-arrow-hover-color: #f5f5f5;
--test-arrow-hover-background-color: #4e8bca;
--rust-logo-filter: initial;
}
.slider {
@ -70,12 +71,6 @@ input:focus + .slider {
box-shadow: 0 0 0 2px #0a84ff, 0 0 0 6px rgba(10, 132, 255, 0.3);
}
.rust-logo {
/* This rule exists to force other themes to explicitly style the logo.
* Rustdoc has a custom linter for this purpose.
*/
}
.content .item-info::before { color: #ccc; }
body.source .example-wrap pre.rust a {

View file

@ -17,6 +17,15 @@ define-function: (
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
("assert-css", (".rust-logo", {"filter": |filter|})),
// Now we check that the non-rust logos don't have a CSS filter set.
("goto", "file://" + |DOC_PATH| + "/huge_logo/index.html"),
// Changing theme on the new page (again...).
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
("reload"),
// Check there is no rust logo
("assert-false", ".rust-logo"),
// Check there is no filter.
("assert-css", (".sidebar .logo-container img", {"filter": "none"})),
],
)