Skip to content

Commit 397e4b1

Browse files
Migrate scraped-examples top and bottom "borders" to CSS variables
1 parent 56ee852 commit 397e4b1

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -1907,9 +1907,15 @@ in storage.js
19071907
}
19081908
.scraped-example:not(.expanded) .code-wrapper:before {
19091909
top: 0;
1910+
background: linear-gradient(to bottom,
1911+
var(--scrape-example-code-wrapper-background-start),
1912+
var(--scrape-example-code-wrapper-background-end));
19101913
}
19111914
.scraped-example:not(.expanded) .code-wrapper:after {
19121915
bottom: 0;
1916+
background: linear-gradient(to top,
1917+
var(--scrape-example-code-wrapper-background-start),
1918+
var(--scrape-example-code-wrapper-background-end));
19131919
}
19141920

19151921
.scraped-example .code-wrapper .example-wrap {

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

+2-7
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
9797
--scrape-example-help-color: #eee;
9898
--scrape-example-help-hover-border-color: #fff;
9999
--scrape-example-help-hover-color: #fff;
100+
--scrape-example-code-wrapper-background-start: rgba(15, 20, 25, 1);
101+
--scrape-example-code-wrapper-background-end: rgba(15, 20, 25, 0);
100102
}
101103

102104
h1, h2, h3, h4 {
@@ -203,10 +205,3 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */
203205
#source-sidebar div.files > a.selected {
204206
color: #ffb44c;
205207
}
206-
207-
.scraped-example:not(.expanded) .code-wrapper::before {
208-
background: linear-gradient(to bottom, rgba(15, 20, 25, 1), rgba(15, 20, 25, 0));
209-
}
210-
.scraped-example:not(.expanded) .code-wrapper::after {
211-
background: linear-gradient(to top, rgba(15, 20, 25, 1), rgba(15, 20, 25, 0));
212-
}

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

+2-7
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
--scrape-example-help-color: #eee;
9393
--scrape-example-help-hover-border-color: #fff;
9494
--scrape-example-help-hover-color: #fff;
95+
--scrape-example-code-wrapper-background-start: rgba(53, 53, 53, 1);
96+
--scrape-example-code-wrapper-background-end: rgba(53, 53, 53, 0);
9597
}
9698

9799
#search-tabs > button:not(.selected) {
@@ -103,10 +105,3 @@
103105
border-top-color: #0089ff;
104106
background-color: #353535;
105107
}
106-
107-
.scraped-example:not(.expanded) .code-wrapper::before {
108-
background: linear-gradient(to bottom, rgba(53, 53, 53, 1), rgba(53, 53, 53, 0));
109-
}
110-
.scraped-example:not(.expanded) .code-wrapper::after {
111-
background: linear-gradient(to top, rgba(53, 53, 53, 1), rgba(53, 53, 53, 0));
112-
}

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

+2-7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
--scrape-example-help-color: #333;
9090
--scrape-example-help-hover-border-color: #000;
9191
--scrape-example-help-hover-color: #000;
92+
--scrape-example-code-wrapper-background-start: rgba(255, 255, 255, 1);
93+
--scrape-example-code-wrapper-background-end: rgba(255, 255, 255, 0);
9294
}
9395

9496
#search-tabs > button:not(.selected) {
@@ -100,10 +102,3 @@
100102
background-color: #ffffff;
101103
border-top-color: #0089ff;
102104
}
103-
104-
.scraped-example:not(.expanded) .code-wrapper::before {
105-
background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
106-
}
107-
.scraped-example:not(.expanded) .code-wrapper::after {
108-
background: linear-gradient(to top, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
109-
}

0 commit comments

Comments
 (0)