Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix headings colors #99812

Merged
merged 3 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ h2, h3, h4 {
h2,
.top-doc .docblock > h3,
.top-doc .docblock > h4 {
border-bottom: 1px solid;
border-bottom: 1px solid var(--headings-border-bottom-color);
}
h3.code-header {
font-size: 1.125rem; /* 18px */
Expand Down Expand Up @@ -652,7 +652,7 @@ h2.location a {
}

.top-doc .docblock h2 { font-size: 1.375rem; }
.top-doc .docblock h3 { font-size: 1.25; }
.top-doc .docblock h3 { font-size: 1.25rem; }
.top-doc .docblock h4,
.top-doc .docblock h5 {
font-size: 1.125rem;
Expand Down
4 changes: 0 additions & 4 deletions src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ input:focus + .slider {
background-color: #0a042f !important;
}

.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5, .docblock h6 {
border-bottom-color: #DDD;
}

.docblock table td, .docblock table th {
border-color: #ddd;
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/rustdoc-gui/docblock-details.goml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ reload:
assert-text: (".top-doc .docblock > h3", "Hello")
assert-css: (
".top-doc .docblock > h3",
{"border-bottom": "1px solid rgb(221, 221, 221)"},
{"border-bottom": "1px solid rgb(210, 210, 210)"},
)
// We now check that the `<summary>` doesn't have a bottom border and has the correct display.
assert-css: (
".top-doc .docblock summary h4",
{"border-bottom": "0px none rgb(221, 221, 221)"},
{"border-bottom": "0px none rgb(210, 210, 210)"},
)
// This allows to ensure that summary is on one line only!
assert-property: (".top-doc .docblock summary h4", {"offsetHeight": "33"})
Expand Down
100 changes: 97 additions & 3 deletions src/test/rustdoc-gui/headings.goml
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,109 @@ assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})

goto: file://|DOC_PATH|/staged_api/struct.Foo.html
// Checking colors now.
show-text: true
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
goto: file://|DOC_PATH|/test_docs/struct.HeavilyDocumentedStruct.html
assert-css: (
".top-doc .docblock h2",
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
)
assert-css: (
".top-doc .docblock h3",
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
)
assert-css: (
".top-doc .docblock h4",
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
)
assert-css: (
".top-doc .docblock h5",
{"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"},
)
assert-css: (
"#implementations-list .docblock h4",
{"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"},
)
assert-css: (
"#implementations-list .docblock h5",
{"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"},
)
assert-css: (
"#implementations-list .docblock h6",
{"color": "rgb(0, 0, 0)", "border-bottom": "0px none rgb(221, 221, 221)"},
)

local-storage: {"rustdoc-theme": "dark"}
reload:
assert-css: (
".top-doc .docblock h2",
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
)
assert-css: (
".top-doc .docblock h3",
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
)
assert-css: (
".top-doc .docblock h4",
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
)
assert-css: (
".top-doc .docblock h5",
{"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"},
)
assert-css: (
"#implementations-list .docblock h4",
{"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"},
)
assert-css: (
"#implementations-list .docblock h5",
{"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"},
)
assert-css: (
"#implementations-list .docblock h6",
{"color": "rgb(221, 221, 221)", "border-bottom": "0px none rgb(210, 210, 210)"},
)

local-storage: {"rustdoc-theme": "ayu"}
reload:
assert-css: (
".top-doc .docblock h2",
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
)
assert-css: (
".top-doc .docblock h2",
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
)
assert-css: (
".top-doc .docblock h4",
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
)
assert-css: (
".top-doc .docblock h5",
{"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"},
)
assert-css: (
"#implementations-list .docblock h4",
{"color": "rgb(255, 255, 255)", "border-bottom": "0px none rgb(92, 103, 115)"},
)
assert-css: (
"#implementations-list .docblock h5",
{"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"},
)
assert-css: (
"#implementations-list .docblock h6",
{"color": "rgb(197, 197, 197)", "border-bottom": "0px none rgb(92, 103, 115)"},
)

local-storage: {"rustdoc-theme": "light"}
goto: file://|DOC_PATH|/staged_api/struct.Foo.html
assert-css: (".since", {"color": "rgb(128, 128, 128)"})

local-storage: {"rustdoc-theme": "dark", "rustdoc-use-system-theme": "false"}
local-storage: {"rustdoc-theme": "dark"}
reload:
assert-css: (".since", {"color": "rgb(128, 128, 128)"})

local-storage: {"rustdoc-theme": "ayu", "rustdoc-use-system-theme": "false"}
local-storage: {"rustdoc-theme": "ayu"}
reload:
assert-css: (".since", {"color": "rgb(128, 128, 128)"})
4 changes: 4 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ pub use crate::repro as repro2;
/// ### Top-doc Prose sub-sub-heading
///
/// Text below sub-sub-heading
///
/// #### You know the drill.
///
/// More text.
pub struct HeavilyDocumentedStruct {
/// # Title for field
/// ## Sub-heading for field
Expand Down