Skip to content

Commit 9b92ec9

Browse files
authored
BUG - Add --pst-color-heading fallback (#2082)
Nick pointed in #2058 (comment) that the `--pst-heading-color` variable is used by folks to customise the headings colour (this was the colour variable before #2058 which brought this in line with our naming convention `--pst-color-heading`). This change effectively renders the use of `--pst-heading-color` useless, so this PR adds a fallback mechanism for this variable. I also added a note about `--pst-color-heading` being our preferred variable. This is not a "big" breaking change, but it will likely affect folks who do not have their PST version pinned since I just made a release. So, it might be worth publishing this change in a follow-up.
1 parent c47786b commit 9b92ec9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/pydata_sphinx_theme/assets/styles/base/_base.scss

+7-4
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,36 @@ a {
7272
line-height: 1.15;
7373
}
7474

75+
// From 0.16.1, the preferred variable for headings is --pst-color-heading
76+
// if you have --pst-heading-color, this variable will be used, otherwise the default
77+
// --pst-color-heading will be used.
7578
h1 {
7679
@extend %heading-style;
7780

7881
margin-top: 0;
7982
font-size: var(--pst-font-size-h1);
80-
color: var(--pst-color-heading);
83+
color: var(--pst-heading-color, --pst-color-heading);
8184
}
8285

8386
h2 {
8487
@extend %heading-style;
8588

8689
font-size: var(--pst-font-size-h2);
87-
color: var(--pst-color-heading);
90+
color: var(--pst-heading-color, --pst-color-heading);
8891
}
8992

9093
h3 {
9194
@extend %heading-style;
9295

9396
font-size: var(--pst-font-size-h3);
94-
color: var(--pst-color-heading);
97+
color: var(--pst-heading-color, --pst-color-heading);
9598
}
9699

97100
h4 {
98101
@extend %heading-style;
99102

100103
font-size: var(--pst-font-size-h4);
101-
color: var(--pst-color-heading);
104+
color: var(--pst-heading-color, --pst-color-heading);
102105
}
103106

104107
h5 {

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

+3
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ $pst-semantic-colors: (
286286

287287
// assign the "duplicate" colors (ones that just reference other variables)
288288
& {
289+
// From 0.16.1, the preferred variable for headings is --pst-color-heading
290+
// if you have --pst-heading-color, this variable will be used, otherwise the default
291+
// --pst-color-heading will be used
289292
--pst-color-heading: var(--pst-color-text-base);
290293
--pst-color-link: var(--pst-color-primary);
291294
--pst-color-link-hover: var(--pst-color-secondary);

0 commit comments

Comments
 (0)