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

MAINT: Improve font sizing #1129

Merged
merged 6 commits into from
Jan 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
nav.page-toc {
// A little extra space before the buttons
margin-bottom: 1rem;
// Each successive nested item will be a bit smaller
ul > li {
font-size: 0.95em;
}
}

.bd-toc .nav,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
font-size: var(--pst-sidebar-font-size);
}

// override bootstrap when navlink are displayed in the sidebar
.nav-link {
font-size: var(--pst-sidebar-font-size-mobile);
}

&.no-sidebar {
border-right: 0;
}
Expand Down Expand Up @@ -213,11 +218,16 @@ nav.bd-links {
p.caption {
font-weight: var(--pst-sidebar-header-font-weight);
position: relative;
margin-top: 1.25em;
margin-bottom: 0.5em;
margin-top: 1.25rem;
margin-bottom: 0.5rem;
color: var(--pst-color-text-base);
&:first-child {
margin-top: 0;
}

font-size: var(--pst-sidebar-font-size-mobile);
@include media-breakpoint-up($breakpoint-sidebar-primary) {
font-size: var(--pst-sidebar-font-size);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@

font-size: var(--pst-sidebar-font-size-mobile);
@include media-breakpoint-up($breakpoint-sidebar-secondary) {
font-size: var(--pst-sidebar-secondary-font-size);
font-size: var(--pst-sidebar-font-size);
}

// override bootstrap settings
.nav-link {
font-size: var(--pst-sidebar-font-size-mobile);
@include media-breakpoint-up($breakpoint-sidebar-secondary) {
font-size: var(--pst-sidebar-font-size);
}
}

padding: 2rem 1rem 1rem 1rem;
Expand All @@ -26,6 +34,7 @@
.onthispage {
color: var(--pst-color-text-base);
font-weight: var(--pst-sidebar-header-font-weight);
margin-bottom: 0.5rem;
}

@include scrollbar-style();
Expand Down
24 changes: 12 additions & 12 deletions src/pydata_sphinx_theme/assets/styles/variables/_fonts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ html {
*/

// base font size - applied at body/html level
--pst-font-size-base: 15px;
--pst-font-size-base: 1rem;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this changed default font size from 15px to 16px; this causes all text to be a bit bigger, cf. https://matplotlib.org/3.7.1 vs https://matplotlib.org/devdocs.

I didn't see any specific discussion on whether that change was intentional here?


// heading font sizes
--pst-font-size-h1: 36px;
--pst-font-size-h2: 32px;
--pst-font-size-h3: 26px;
--pst-font-size-h4: 21px;
--pst-font-size-h5: 18px;
--pst-font-size-h6: 16px;
// heading font sizes based on bootstrap sizing
--pst-font-size-h1: 2.5rem;
--pst-font-size-h2: 2rem;
--pst-font-size-h3: 1.75rem;
--pst-font-size-h4: 1.5rem;
--pst-font-size-h5: 1.25rem;
--pst-font-size-h6: 1.1rem;

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

// Sidebar styles
--pst-sidebar-font-size: 0.9em;
--pst-sidebar-font-size-mobile: 1.2em;
--pst-sidebar-header-font-size: 1.2em;
--pst-sidebar-font-size: 0.9rem;
--pst-sidebar-font-size-mobile: 1.1rem;
--pst-sidebar-header-font-size: 1.2rem;
--pst-sidebar-header-font-weight: 600;

// Font weights
Expand Down