Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 24d86a1

Browse files
Migrate rust logo filter to CSS variables
1 parent 1e1e5b8 commit 24d86a1

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

src/librustdoc/html/static/css/rustdoc.css

Lines changed: 4 additions & 0 deletions
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
}

src/librustdoc/html/static/css/themes/ayu.css

Lines changed: 4 additions & 7 deletions
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;

src/librustdoc/html/static/css/themes/dark.css

Lines changed: 4 additions & 7 deletions
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 {

src/librustdoc/html/static/css/themes/light.css

Lines changed: 1 addition & 6 deletions
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 {

0 commit comments

Comments
 (0)