Skip to content

Commit 1b4d7b7

Browse files
authored
Rollup merge of rust-lang#91534 - jsha:heading-color, r=GuillaumeGomez
Make rustdoc headings black, and markdown blue Demo: https://rustdoc.crud.net/jsha/heading-color/std/string/index.html#structs https://rustdoc.crud.net/jsha/heading-color/std/string/struct.String.html#examples Fixes rust-lang#91304 r? ``@camelid`` /cc ``@GuillaumeGomez`` (Note: we may want to make rustdoc headings and markdown headings the same color -- rust-lang#90245 -- but we would want to do that intentionally; this is fixing up a change that did so accidentally)
2 parents 250a20b + e1ff02b commit 1b4d7b7

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

src/librustdoc/html/render/print_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
296296
let (short, name) = item_ty_to_strs(myty.unwrap());
297297
write!(
298298
w,
299-
"<h2 id=\"{id}\" class=\"section-header\">\
299+
"<h2 id=\"{id}\" class=\"small-section-header\">\
300300
<a href=\"#{id}\">{name}</a>\
301301
</h2>\n{}",
302302
ITEM_TABLE_OPEN,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ a {
219219
a.srclink,
220220
a#toggle-all-docs,
221221
a.anchor,
222-
.section-header a,
222+
.small-section-header a,
223223
#source-sidebar a,
224224
pre.rust a,
225225
.sidebar a,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ a {
181181
a.srclink,
182182
a#toggle-all-docs,
183183
a.anchor,
184-
.section-header a,
184+
.small-section-header a,
185185
#source-sidebar a,
186186
pre.rust a,
187187
.sidebar a,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ a {
176176
a.srclink,
177177
a#toggle-all-docs,
178178
a.anchor,
179-
.section-header a,
179+
.small-section-header a,
180180
#source-sidebar a,
181181
pre.rust a,
182182
.sidebar a,

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

+12-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
1818
assert-css: ("#method\.must_use", {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, ALL)
1919

2020
goto: file://|DOC_PATH|/test_docs/index.html
21-
assert-css: (".section-header a", {"color": "rgb(197, 197, 197)"}, ALL)
21+
assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL)
22+
23+
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
24+
assert-css: (".section-header a", {"color": "rgb(57, 175, 215)"}, ALL)
2225

2326
// Dark theme
2427
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
@@ -34,7 +37,10 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
3437
assert-css: ("#method\.must_use", {"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"}, ALL)
3538

3639
goto: file://|DOC_PATH|/test_docs/index.html
37-
assert-css: (".section-header a", {"color": "rgb(221, 221, 221)"}, ALL)
40+
assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL)
41+
42+
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
43+
assert-css: (".section-header a", {"color": "rgb(210, 153, 29)"}, ALL)
3844

3945
// Light theme
4046
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
@@ -52,4 +58,7 @@ goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
5258
assert-css: ("#method\.must_use", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"}, ALL)
5359

5460
goto: file://|DOC_PATH|/test_docs/index.html
55-
assert-css: (".section-header a", {"color": "rgb(0, 0, 0)"}, ALL)
61+
assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL)
62+
63+
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
64+
assert-css: (".section-header a", {"color": "rgb(56, 115, 173)"}, ALL)

0 commit comments

Comments
 (0)