Skip to content

Commit 8b78fa0

Browse files
authored
Rollup merge of #101593 - GuillaumeGomez:cleanup-theme-tooltip, r=notriddle
Cleanup themes (tooltip) No changes in the UI. I used this opportunity to unify the dark theme with the others for the alpha parameter though. r? `@notriddle`
2 parents 1a61afd + f9da510 commit 8b78fa0

File tree

7 files changed

+152
-146
lines changed

7 files changed

+152
-146
lines changed

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

+36
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,42 @@ pre.rust .question-mark {
11601160
font-weight: bold;
11611161
}
11621162

1163+
pre.compile_fail,
1164+
pre.should_panic {
1165+
border-left: 2px solid var(--codeblock-error-color);
1166+
}
1167+
1168+
pre.ignore {
1169+
border-left: 2px solid var(--codeblock-ignore-color);
1170+
}
1171+
1172+
pre.compile_fail:hover, .information:hover + .example-wrap pre.compile_fail,
1173+
pre.should_panic:hover, .information:hover + .example-wrap pre.should_panic {
1174+
border-left: 2px solid var(--codeblock-error-hover-color);
1175+
}
1176+
1177+
pre.ignore:hover, .information:hover + .example-wrap pre.ignore {
1178+
border-left: 2px solid var(--codeblock-ignore-hover-color);
1179+
}
1180+
1181+
.tooltip.compile_fail,
1182+
.tooltip.should_panic {
1183+
color: var(--codeblock-error-color);
1184+
}
1185+
1186+
.tooltip.ignore {
1187+
color: var(--codeblock-ignore-color);
1188+
}
1189+
1190+
.information > .compile_fail:hover,
1191+
.information > .should_panic:hover {
1192+
color: var(--codeblock-error-hover-color);
1193+
}
1194+
1195+
.information > .ignore:hover {
1196+
color: var(--codeblock-ignore-hover-color);
1197+
}
1198+
11631199
a.test-arrow {
11641200
display: inline-block;
11651201
visibility: hidden;

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

+4-48
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Original by Dempfi (https://github.com/dempfi/ayu)
2323
--copy-path-button-color: #fff;
2424
--copy-path-img-filter: invert(70%);
2525
--copy-path-img-hover-filter: invert(100%);
26+
--codeblock-error-hover-color: rgb(255, 0, 0);
27+
--codeblock-error-color: rgba(255, 0, 0, .5);
28+
--codeblock-ignore-hover-color: rgb(255, 142, 0);
29+
--codeblock-ignore-color: rgba(255, 142, 0, .6);
2630
}
2731

2832
.slider {
@@ -244,54 +248,6 @@ a.test-arrow:hover {
244248
border-right: 3px solid rgba(255, 180, 76, 0.85);
245249
}
246250

247-
pre.compile_fail {
248-
border-left: 2px solid rgba(255,0,0,.4);
249-
}
250-
251-
pre.compile_fail:hover, .information:hover + pre.compile_fail {
252-
border-left: 2px solid #f00;
253-
}
254-
255-
pre.should_panic {
256-
border-left: 2px solid rgba(255,0,0,.4);
257-
}
258-
259-
pre.should_panic:hover, .information:hover + pre.should_panic {
260-
border-left: 2px solid #f00;
261-
}
262-
263-
pre.ignore {
264-
border-left: 2px solid rgba(255,142,0,.6);
265-
}
266-
267-
pre.ignore:hover, .information:hover + pre.ignore {
268-
border-left: 2px solid #ff9200;
269-
}
270-
271-
.tooltip.compile_fail {
272-
color: rgba(255,0,0,.5);
273-
}
274-
275-
.information > .compile_fail:hover {
276-
color: #f00;
277-
}
278-
279-
.tooltip.should_panic {
280-
color: rgba(255,0,0,.5);
281-
}
282-
283-
.information > .should_panic:hover {
284-
color: #f00;
285-
}
286-
287-
.tooltip.ignore {
288-
color: rgba(255,142,0,.6);
289-
}
290-
291-
.information > .ignore:hover {
292-
color: #ff9200;
293-
}
294-
295251
.search-failed a {
296252
color: #39AFD7;
297253
}

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

+4-48
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
--copy-path-button-color: #999;
1919
--copy-path-img-filter: invert(50%);
2020
--copy-path-img-hover-filter: invert(65%);
21+
--codeblock-error-hover-color: rgb(255, 0, 0);
22+
--codeblock-error-color: rgba(255, 0, 0, .5);
23+
--codeblock-ignore-hover-color: rgb(255, 142, 0);
24+
--codeblock-ignore-color: rgba(255, 142, 0, .6);
2125
}
2226

2327
.slider {
@@ -194,54 +198,6 @@ a.test-arrow:hover{
194198
border-right: 3px solid #bb7410;
195199
}
196200

197-
pre.compile_fail {
198-
border-left: 2px solid rgba(255,0,0,.8);
199-
}
200-
201-
pre.compile_fail:hover, .information:hover + pre.compile_fail {
202-
border-left: 2px solid #f00;
203-
}
204-
205-
pre.should_panic {
206-
border-left: 2px solid rgba(255,0,0,.8);
207-
}
208-
209-
pre.should_panic:hover, .information:hover + pre.should_panic {
210-
border-left: 2px solid #f00;
211-
}
212-
213-
pre.ignore {
214-
border-left: 2px solid rgba(255,142,0,.6);
215-
}
216-
217-
pre.ignore:hover, .information:hover + pre.ignore {
218-
border-left: 2px solid #ff9200;
219-
}
220-
221-
.tooltip.compile_fail {
222-
color: rgba(255,0,0,.8);
223-
}
224-
225-
.information > .compile_fail:hover {
226-
color: #f00;
227-
}
228-
229-
.tooltip.should_panic {
230-
color: rgba(255,0,0,.8);
231-
}
232-
233-
.information > .should_panic:hover {
234-
color: #f00;
235-
}
236-
237-
.tooltip.ignore {
238-
color: rgba(255,142,0,.6);
239-
}
240-
241-
.information > .ignore:hover {
242-
color: #ff9200;
243-
}
244-
245201
.search-failed a {
246202
color: #0089ff;
247203
}

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

+4-48
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
--copy-path-button-color: #999;
1919
--copy-path-img-filter: invert(50%);
2020
--copy-path-img-hover-filter: invert(35%);
21+
--codeblock-error-hover-color: rgb(255, 0, 0);
22+
--codeblock-error-color: rgba(255, 0, 0, .5);
23+
--codeblock-ignore-hover-color: rgb(255, 142, 0);
24+
--codeblock-ignore-color: rgba(255, 142, 0, .6);
2125
}
2226

2327
.slider {
@@ -180,54 +184,6 @@ a.test-arrow:hover{
180184
border-right: 3px solid #AD7C37;
181185
}
182186

183-
pre.compile_fail {
184-
border-left: 2px solid rgba(255,0,0,.5);
185-
}
186-
187-
pre.compile_fail:hover, .information:hover + pre.compile_fail {
188-
border-left: 2px solid #f00;
189-
}
190-
191-
pre.should_panic {
192-
border-left: 2px solid rgba(255,0,0,.5);
193-
}
194-
195-
pre.should_panic:hover, .information:hover + pre.should_panic {
196-
border-left: 2px solid #f00;
197-
}
198-
199-
pre.ignore {
200-
border-left: 2px solid rgba(255,142,0,.6);
201-
}
202-
203-
pre.ignore:hover, .information:hover + pre.ignore {
204-
border-left: 2px solid #ff9200;
205-
}
206-
207-
.tooltip.compile_fail {
208-
color: rgba(255,0,0,.5);
209-
}
210-
211-
.information > .compile_fail:hover {
212-
color: #f00;
213-
}
214-
215-
.tooltip.should_panic {
216-
color: rgba(255,0,0,.5);
217-
}
218-
219-
.information > .should_panic:hover {
220-
color: #f00;
221-
}
222-
223-
.tooltip.ignore {
224-
color: rgba(255,142,0,.6);
225-
}
226-
227-
.information > .ignore:hover {
228-
color: #ff9200;
229-
}
230-
231187
.search-failed a {
232188
color: #3873AD;
233189
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// This test ensures that items and documentation code blocks are wrapped in <pre><code>
22
goto: file://|DOC_PATH|/test_docs/fn.foo.html
33
size: (1080, 600)
4-
// There should be three doc codeblocks
4+
// There should be four doc codeblocks.
55
// Check that their content is inside <pre><code>
6-
assert-count: (".example-wrap pre > code", 3)
6+
assert-count: (".example-wrap pre > code", 4)
77
// Check that function signature is inside <pre><code>
88
assert: "pre.rust.fn > code"
99

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Checking the colors of the codeblocks tooltips.
2+
goto: file://|DOC_PATH|/test_docs/fn.foo.html
3+
show-text: true
4+
5+
// Dark theme.
6+
local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
7+
reload:
8+
9+
// compile_fail block
10+
assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"})
11+
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
12+
13+
move-cursor-to: ".docblock .information .compile_fail"
14+
15+
assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"})
16+
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
17+
18+
// should_panic block
19+
assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"})
20+
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
21+
22+
move-cursor-to: ".docblock .information .should_panic"
23+
24+
assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"})
25+
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
26+
27+
// ignore block
28+
assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"})
29+
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
30+
31+
move-cursor-to: ".docblock .information .ignore"
32+
33+
assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"})
34+
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
35+
36+
37+
// Light theme.
38+
local-storage: {"rustdoc-theme": "light"}
39+
reload:
40+
41+
assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"})
42+
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
43+
44+
move-cursor-to: ".docblock .information .compile_fail"
45+
46+
assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"})
47+
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
48+
49+
// should_panic block
50+
assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"})
51+
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
52+
53+
move-cursor-to: ".docblock .information .should_panic"
54+
55+
assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"})
56+
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
57+
58+
// ignore block
59+
assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"})
60+
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
61+
62+
move-cursor-to: ".docblock .information .ignore"
63+
64+
assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"})
65+
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"})
66+
67+
68+
// Ayu theme.
69+
local-storage: {"rustdoc-theme": "ayu"}
70+
reload:
71+
72+
assert-css: (".docblock .information .compile_fail", {"color": "rgba(255, 0, 0, 0.5)"})
73+
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
74+
75+
move-cursor-to: ".docblock .information .compile_fail"
76+
77+
assert-css: (".docblock .information .compile_fail", {"color": "rgb(255, 0, 0)"})
78+
assert-css: (".docblock .example-wrap .compile_fail", {"border-left": "2px solid rgb(255, 0, 0)"})
79+
80+
// should_panic block
81+
assert-css: (".docblock .information .should_panic", {"color": "rgba(255, 0, 0, 0.5)"})
82+
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgba(255, 0, 0, 0.5)"})
83+
84+
move-cursor-to: ".docblock .information .should_panic"
85+
86+
assert-css: (".docblock .information .should_panic", {"color": "rgb(255, 0, 0)"})
87+
assert-css: (".docblock .example-wrap .should_panic", {"border-left": "2px solid rgb(255, 0, 0)"})
88+
89+
// ignore block
90+
assert-css: (".docblock .information .ignore", {"color": "rgba(255, 142, 0, 0.6)"})
91+
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgba(255, 142, 0, 0.6)"})
92+
93+
move-cursor-to: ".docblock .information .ignore"
94+
95+
assert-css: (".docblock .information .ignore", {"color": "rgb(255, 142, 0)"})
96+
assert-css: (".docblock .example-wrap .ignore", {"border-left": "2px solid rgb(255, 142, 0)"})

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

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ use std::fmt;
2828
/// Let's say I'm just some text will ya?
2929
/// ```
3030
///
31+
/// A failing to run one:
32+
///
33+
/// ```should_panic
34+
/// panic!("tadam");
35+
/// ```
36+
///
3137
/// An inlined `code`!
3238
pub fn foo() {}
3339

0 commit comments

Comments
 (0)