Skip to content

Commit fe6161a

Browse files
author
Yuki Okushi
authored
Rollup merge of rust-lang#104065 - GuillaumeGomez:css-migrate-logo-filter, r=notriddle
Migrate rust logo filter to CSS variables
2 parents 458b132 + 0e23d90 commit fe6161a

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

Diff for: src/librustdoc/html/static/css/rustdoc.css

+4
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,10 @@ img {
378378
object-fit: contain;
379379
}
380380

381+
.rust-logo {
382+
filter: var(--rust-logo-filter);
383+
}
384+
381385
.sidebar, .mobile-topbar, .sidebar-menu-toggle {
382386
background-color: var(--sidebar-background-color);
383387
}

Diff for: src/librustdoc/html/static/css/themes/ayu.css

+4-7
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ Original by Dempfi (https://github.com/dempfi/ayu)
6363
--test-arrow-background-color: rgba(57, 175, 215, 0.09);
6464
--test-arrow-hover-color: #c5c5c5;
6565
--test-arrow-hover-background-color: rgba(57, 175, 215, 0.368);
66+
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
67+
drop-shadow(0 1px 0 #fff)
68+
drop-shadow(-1px 0 0 #fff)
69+
drop-shadow(0 -1px 0 #fff);
6670
}
6771

6872
.slider {
@@ -104,13 +108,6 @@ pre, .rustdoc.source .example-wrap {
104108
color: #e6e1cf;
105109
}
106110

107-
.rust-logo {
108-
filter: drop-shadow(1px 0 0px #fff)
109-
drop-shadow(0 1px 0 #fff)
110-
drop-shadow(-1px 0 0 #fff)
111-
drop-shadow(0 -1px 0 #fff);
112-
}
113-
114111
.sidebar .current,
115112
.sidebar a:hover {
116113
color: #ffb44c;

Diff for: src/librustdoc/html/static/css/themes/dark.css

+4-7
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
--test-arrow-background-color: rgba(78, 139, 202, 0.2);
5959
--test-arrow-hover-color: #dedede;
6060
--test-arrow-hover-background-color: #4e8bca;
61+
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
62+
drop-shadow(0 1px 0 #fff)
63+
drop-shadow(-1px 0 0 #fff)
64+
drop-shadow(0 -1px 0 #fff);
6165
}
6266

6367
.slider {
@@ -70,13 +74,6 @@ input:focus + .slider {
7074
box-shadow: 0 0 0 2px #0a84ff, 0 0 0 6px rgba(10, 132, 255, 0.3);
7175
}
7276

73-
.rust-logo {
74-
filter: drop-shadow(1px 0 0px #fff)
75-
drop-shadow(0 1px 0 #fff)
76-
drop-shadow(-1px 0 0 #fff)
77-
drop-shadow(0 -1px 0 #fff)
78-
}
79-
8077
.content .item-info::before { color: #ccc; }
8178

8279
body.source .example-wrap pre.rust a {

Diff for: src/librustdoc/html/static/css/themes/light.css

+1-6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
--test-arrow-background-color: rgba(78, 139, 202, 0.2);
5959
--test-arrow-hover-color: #f5f5f5;
6060
--test-arrow-hover-background-color: #4e8bca;
61+
--rust-logo-filter: initial;
6162
}
6263

6364
.slider {
@@ -70,12 +71,6 @@ input:focus + .slider {
7071
box-shadow: 0 0 0 2px #0a84ff, 0 0 0 6px rgba(10, 132, 255, 0.3);
7172
}
7273

73-
.rust-logo {
74-
/* This rule exists to force other themes to explicitly style the logo.
75-
* Rustdoc has a custom linter for this purpose.
76-
*/
77-
}
78-
7974
.content .item-info::before { color: #ccc; }
8075

8176
body.source .example-wrap pre.rust a {

Diff for: src/test/rustdoc-gui/rust-logo.goml

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ define-function: (
1717
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
1818
("reload"),
1919
("assert-css", (".rust-logo", {"filter": |filter|})),
20+
// Now we check that the non-rust logos don't have a CSS filter set.
21+
("goto", "file://" + |DOC_PATH| + "/huge_logo/index.html"),
22+
// Changing theme on the new page (again...).
23+
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
24+
("reload"),
25+
// Check there is no rust logo
26+
("assert-false", ".rust-logo"),
27+
// Check there is no filter.
28+
("assert-css", (".sidebar .logo-container img", {"filter": "none"})),
2029
],
2130
)
2231

0 commit comments

Comments
 (0)