Skip to content

Commit 6b4ee8c

Browse files
kartbencarlescufi
authored andcommitted
doc: make headings more visually identifiable
Before this change, headings in documentation pages were using the same font family as the rest of the content, which made them blend in too much. This introduces a humanist font stack for the headings as well as some minor tweaks to make the hierarchy of the document clearer through better differentiation of the different levels (i.e. not just relying on font size). Signed-off-by: Benjamin Cabé <[email protected]>
1 parent cbaabc2 commit 6b4ee8c

File tree

1 file changed

+62
-4
lines changed

1 file changed

+62
-4
lines changed

doc/_static/css/custom.css

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
* visual identity. Many colors are also overridden to use CSS variables.
88
*/
99

10+
:root {
11+
/* Use system font stacks for better performance (no Web fonts required) */
12+
--system-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
13+
--header-font-family: Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif;
14+
}
15+
1016
body,
1117
h1,
1218
h2,
@@ -23,8 +29,7 @@ legend,
2329
.btn,
2430
.rst-content .toctree-wrapper p.caption,
2531
.rst-versions {
26-
/* Use a system font stack for better performance (no Web fonts required) */
27-
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32+
font-family: var(--system-font-family);
2833
}
2934

3035
h1,
@@ -35,8 +40,9 @@ h5,
3540
h6,
3641
legend,
3742
.rst-content .toctree-wrapper p.caption {
38-
/* Use a lighter font for headers (Medium instead of Bold) */
39-
font-weight: 500;
43+
/* Use a lighter font for headers (Semi-Bold instead of Bold) */
44+
font-weight: 600;
45+
font-family: var(--header-font-family);
4046
}
4147

4248
.rst-content div.figure p.caption {
@@ -497,6 +503,58 @@ kbd, .kbd,
497503
border-color: var(--guiitems-border-color);
498504
}
499505

506+
/* heading tweaks to make document hierarchy easier to grasp */
507+
508+
.rst-content section > h1 {
509+
font-weight: 700;
510+
margin-bottom: 2.5rem;
511+
position: relative;
512+
line-height: 1;
513+
z-index: 1;
514+
}
515+
516+
.rst-content section > h1::before {
517+
content: '';
518+
position: absolute;
519+
z-index:-1;
520+
left: 0;
521+
right: 0;
522+
height: 4px;
523+
bottom: -1px;
524+
background: linear-gradient(to right, var(--admonition-note-title-background-color), var(--admonition-note-title-background-color) 50%, var(--admonition-note-background-color) 80%, transparent); /* Example gradient */
525+
opacity:50%;
526+
}
527+
528+
.rst-content section > h2,
529+
.rst-content section > h3,
530+
.rst-content section > h4,
531+
.rst-content section > h5 {
532+
font-weight: 500;
533+
padding-inline-start: 8px;
534+
margin-inline-start: 0px;
535+
border-inline-start: 8px solid;
536+
padding-top: 0.2em;
537+
padding-bottom: 0.2em;
538+
}
539+
540+
.rst-content section > h2 {
541+
border-color: var(--admonition-note-title-background-color);
542+
}
543+
544+
.rst-content section > h3 {
545+
border-color: var(--admonition-note-background-color);
546+
}
547+
548+
.rst-content section > h4 {
549+
border-color: transparent;
550+
font-weight: 400;
551+
}
552+
553+
.rst-content section > h5 {
554+
border-color: transparent;
555+
font-weight: 100;
556+
}
557+
500558
/* Buttons */
501559

502560
.btn-neutral {

0 commit comments

Comments
 (0)