Rollup merge of #106218 - GuillaumeGomez:migrate-css-var-scraped-examples, r=notriddle

Migrate css var scraped examples

r? ``@notriddle``
This commit is contained in:
Matthias Krüger 2022-12-29 13:16:03 +01:00 committed by GitHub
commit 2c4560cb12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 18 deletions

View file

@ -1955,6 +1955,13 @@ in storage.js
overflow-x: hidden;
}
.scraped-example .example-wrap .rust span.highlight {
background: var(--scrape-example-code-line-highlight);
}
.scraped-example .example-wrap .rust span.highlight.focus {
background: var(--scrape-example-code-line-highlight-focus);
}
.more-examples-toggle {
max-width: calc(100% + 25px);
margin-top: 10px;

View file

@ -91,6 +91,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
--codeblock-link-background: #333;
--scrape-example-toggle-line-background: #999;
--scrape-example-toggle-line-hover-background: #c5c5c5;
--scrape-example-code-line-highlight: rgb(91, 59, 1);
--scrape-example-code-line-highlight-focus: rgb(124, 75, 15);
}
h1, h2, h3, h4 {
@ -206,12 +208,6 @@ above the `@media (max-width: 700px)` rules due to a bug in the css checker */
border-color: white;
color: white;
}
.scraped-example .example-wrap .rust span.highlight {
background: rgb(91, 59, 1);
}
.scraped-example .example-wrap .rust span.highlight.focus {
background: rgb(124, 75, 15);
}
.scraped-example:not(.expanded) .code-wrapper::before {
background: linear-gradient(to bottom, rgba(15, 20, 25, 1), rgba(15, 20, 25, 0));
}

View file

@ -86,6 +86,8 @@
--codeblock-link-background: #333;
--scrape-example-toggle-line-background: #999;
--scrape-example-toggle-line-hover-background: #c5c5c5;
--scrape-example-code-line-highlight: rgb(91, 59, 1);
--scrape-example-code-line-highlight-focus: rgb(124, 75, 15);
}
#search-tabs > button:not(.selected) {
@ -106,12 +108,6 @@
border-color: white;
color: white;
}
.scraped-example .example-wrap .rust span.highlight {
background: rgb(91, 59, 1);
}
.scraped-example .example-wrap .rust span.highlight.focus {
background: rgb(124, 75, 15);
}
.scraped-example:not(.expanded) .code-wrapper::before {
background: linear-gradient(to bottom, rgba(53, 53, 53, 1), rgba(53, 53, 53, 0));
}

View file

@ -83,6 +83,8 @@
--codeblock-link-background: #eee;
--scrape-example-toggle-line-background: #ccc;
--scrape-example-toggle-line-hover-background: #999;
--scrape-example-code-line-highlight: #fcffd6;
--scrape-example-code-line-highlight-focus: #f6fdb0;
}
#search-tabs > button:not(.selected) {
@ -103,12 +105,6 @@
border-color: black;
color: black;
}
.scraped-example .example-wrap .rust span.highlight {
background: #fcffd6;
}
.scraped-example .example-wrap .rust span.highlight.focus {
background: #f6fdb0;
}
.scraped-example:not(.expanded) .code-wrapper::before {
background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}

View file

@ -0,0 +1,34 @@
// Check that scrape example code blocks have the expected colors.
goto: "file://" + |DOC_PATH| + "/scrape_examples/fn.test_many.html"
define-function: (
"check-colors",
(theme, highlight, highlight_focus),
[
("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", }),
("reload"),
("wait-for", ".more-examples-toggle"),
("assert-css", (".scraped-example .example-wrap .rust span.highlight:not(.focus)", {
"background-color": |highlight|,
}, ALL)),
("assert-css", (".scraped-example .example-wrap .rust span.highlight.focus", {
"background-color": |highlight_focus|,
}, ALL)),
]
)
call-function: ("check-colors", {
"theme": "ayu",
"highlight": "rgb(91, 59, 1)",
"highlight_focus": "rgb(124, 75, 15)",
})
call-function: ("check-colors", {
"theme": "dark",
"highlight": "rgb(91, 59, 1)",
"highlight_focus": "rgb(124, 75, 15)",
})
call-function: ("check-colors", {
"theme": "light",
"highlight": "rgb(252, 255, 214)",
"highlight_focus": "rgb(246, 253, 176)",
})