Skip to content

Commit a6329b6

Browse files
authored
MAINT: Improve font sizing (#1129)
Fix #1001
1 parent 4ce02b8 commit a6329b6

File tree

4 files changed

+34
-19
lines changed

4 files changed

+34
-19
lines changed

src/pydata_sphinx_theme/assets/styles/components/_toc-inpage.scss

-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
nav.page-toc {
55
// A little extra space before the buttons
66
margin-bottom: 1rem;
7-
// Each successive nested item will be a bit smaller
8-
ul > li {
9-
font-size: 0.95em;
10-
}
117
}
128

139
.bd-toc .nav,

src/pydata_sphinx_theme/assets/styles/sections/_sidebar-primary.scss

+12-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
font-size: var(--pst-sidebar-font-size);
2525
}
2626

27+
// override bootstrap when navlink are displayed in the sidebar
28+
.nav-link {
29+
font-size: var(--pst-sidebar-font-size-mobile);
30+
}
31+
2732
&.no-sidebar {
2833
border-right: 0;
2934
}
@@ -213,11 +218,16 @@ nav.bd-links {
213218
p.caption {
214219
font-weight: var(--pst-sidebar-header-font-weight);
215220
position: relative;
216-
margin-top: 1.25em;
217-
margin-bottom: 0.5em;
221+
margin-top: 1.25rem;
222+
margin-bottom: 0.5rem;
218223
color: var(--pst-color-text-base);
219224
&:first-child {
220225
margin-top: 0;
221226
}
227+
228+
font-size: var(--pst-sidebar-font-size-mobile);
229+
@include media-breakpoint-up($breakpoint-sidebar-primary) {
230+
font-size: var(--pst-sidebar-font-size);
231+
}
222232
}
223233
}

src/pydata_sphinx_theme/assets/styles/sections/_sidebar-secondary.scss

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@
1313

1414
font-size: var(--pst-sidebar-font-size-mobile);
1515
@include media-breakpoint-up($breakpoint-sidebar-secondary) {
16-
font-size: var(--pst-sidebar-secondary-font-size);
16+
font-size: var(--pst-sidebar-font-size);
17+
}
18+
19+
// override bootstrap settings
20+
.nav-link {
21+
font-size: var(--pst-sidebar-font-size-mobile);
22+
@include media-breakpoint-up($breakpoint-sidebar-secondary) {
23+
font-size: var(--pst-sidebar-font-size);
24+
}
1725
}
1826

1927
padding: 2rem 1rem 1rem 1rem;
@@ -26,6 +34,7 @@
2634
.onthispage {
2735
color: var(--pst-color-text-base);
2836
font-weight: var(--pst-sidebar-header-font-weight);
37+
margin-bottom: 0.5rem;
2938
}
3039

3140
@include scrollbar-style();

src/pydata_sphinx_theme/assets/styles/variables/_fonts.scss

+12-12
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ html {
44
*/
55

66
// base font size - applied at body/html level
7-
--pst-font-size-base: 15px;
7+
--pst-font-size-base: 1rem;
88

9-
// heading font sizes
10-
--pst-font-size-h1: 36px;
11-
--pst-font-size-h2: 32px;
12-
--pst-font-size-h3: 26px;
13-
--pst-font-size-h4: 21px;
14-
--pst-font-size-h5: 18px;
15-
--pst-font-size-h6: 16px;
9+
// heading font sizes based on bootstrap sizing
10+
--pst-font-size-h1: 2.5rem;
11+
--pst-font-size-h2: 2rem;
12+
--pst-font-size-h3: 1.75rem;
13+
--pst-font-size-h4: 1.5rem;
14+
--pst-font-size-h5: 1.25rem;
15+
--pst-font-size-h6: 1.1rem;
1616

1717
// smaller than heading font sizes
18-
--pst-font-size-milli: 12px;
18+
--pst-font-size-milli: 0.9rem;
1919

2020
// Sidebar styles
21-
--pst-sidebar-font-size: 0.9em;
22-
--pst-sidebar-font-size-mobile: 1.2em;
23-
--pst-sidebar-header-font-size: 1.2em;
21+
--pst-sidebar-font-size: 0.9rem;
22+
--pst-sidebar-font-size-mobile: 1.1rem;
23+
--pst-sidebar-header-font-size: 1.2rem;
2424
--pst-sidebar-header-font-weight: 600;
2525

2626
// Font weights

0 commit comments

Comments
 (0)