Skip to content

Commit 26feefd

Browse files
Rollup merge of #88419 - GuillaumeGomez:code-blocks-colors, r=camelid,notriddle
Fix code blocks color in Ayu theme Fixes #88415. cc `@camelid` r? `@notriddle`
2 parents 7248ff2 + 261ee26 commit 26feefd

File tree

4 files changed

+33
-14
lines changed

4 files changed

+33
-14
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ h4 {
4040
.code-header {
4141
color: #e6e1cf;
4242
}
43-
pre > code {
43+
.docblock pre > code, pre > code {
4444
color: #e6e1cf;
4545
}
4646
span code {

src/test/rustdoc-gui/ayu-code-tag-colors.goml

-13
This file was deleted.

src/test/rustdoc-gui/code-color.goml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// The ayu theme has a different color for the "<code>" tags in the doc blocks. We need to
2+
// check that the rule isn't applied on other "<code>" elements.
3+
//
4+
// While we're at it, we also check it for the other themes.
5+
goto: file://|DOC_PATH|/test_docs/fn.foo.html
6+
// If the text isn't displayed, the browser doesn't compute color style correctly...
7+
show-text: true
8+
// Set the theme to dark.
9+
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
10+
// We reload the page so the local storage settings are being used.
11+
reload:
12+
13+
assert-css: (".docblock pre > code", {"color": "rgb(221, 221, 221)"}, ALL)
14+
assert-css: (".docblock > p > code", {"color": "rgb(221, 221, 221)"}, ALL)
15+
16+
// Set the theme to ayu.
17+
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
18+
// We reload the page so the local storage settings are being used.
19+
reload:
20+
21+
assert-css: (".docblock pre > code", {"color": "rgb(230, 225, 207)"}, ALL)
22+
assert-css: (".docblock > p > code", {"color": "rgb(255, 180, 84)"}, ALL)
23+
24+
// Set the theme to light.
25+
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
26+
// We reload the page so the local storage settings are being used.
27+
reload:
28+
29+
assert-css: (".docblock pre > code", {"color": "rgb(0, 0, 0)"}, ALL)
30+
assert-css: (".docblock > p > code", {"color": "rgb(0, 0, 0)"}, ALL)

src/test/rustdoc-gui/src/test_docs/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ use std::fmt;
2525
/// ```ignore (it's a test)
2626
/// Let's say I'm just some text will ya?
2727
/// ```
28+
///
29+
/// An inlined `code`!
2830
pub fn foo() {}
2931

3032
/// Just a normal struct.

0 commit comments

Comments
 (0)