Skip to content

Commit 25e01e2

Browse files
authored
Fix colour variables (#2058)
While working on the design system documentation, we noticed some fixes needed: - **Fix heading colour definition**: Use same colour as body - **Add note about zindex**: Closes #1953 - **Replace the undefined variable with PST variable**: we were using `--pst-color-panel-background` for the background of the card (introduced in #641, but it seems this was removed later and it was not properly replaced). Since cards are meant to give some sense of elevation, I replaced this with `--pst-color-on-background`, which mostly applies to the `dark` theme (see screenshots below) Current colour: ![image](https://github.com/user-attachments/assets/1b87a693-20b7-4d2c-b06f-806483b11d61) In this PR: ![image](https://github.com/user-attachments/assets/5127025f-2012-43e4-b9b0-8c3f3107b953) `light theme` - it's the same before and after as we rely on shadows for elevation ![image](https://github.com/user-attachments/assets/2c779919-40fa-409a-aa49-8a4082618c58) cc @smeragoel
1 parent ace1586 commit 25e01e2

File tree

4 files changed

+32
-40
lines changed

4 files changed

+32
-40
lines changed

docs/community/design-system.md

+23-28
Original file line numberDiff line numberDiff line change
@@ -128,28 +128,6 @@ Semantic colors (such as for success, warning, or error messages) can be used to
128128
convey meaning, but color should not be the only indicator.
129129
Pair these colors with icons or text labels to ensure clarity.
130130

131-
### Relevant Links
132-
133-
For further reference, you can access the following resources related to the
134-
typography in the PyData Sphinx theme:
135-
136-
1. **GitHub Repository:** The source code for the PyData Sphinx theme is available on GitHub.
137-
You can find the specific file that defines the typography settings,
138-
including font stacks, sizes, and weights in the
139-
[`fonts.scss` file](https://github.com/pydata/pydata-sphinx-theme/blob/main/src/pydata_sphinx_theme/assets/styles/variables/_fonts.scss).
140-
2. **Figma Design File:** The Figma file contains the visual design and specifications
141-
for the typography styles, including font sizes, line heights,
142-
and spacing used throughout the theme.
143-
You can access it [through this link to the Figma file](https://www.figma.com/design/BHkBFxg1Qg0h5RApUw1ZrR/PyData-Design-System---Ongoing?node-id=2-7).
144-
145-
### References
146-
147-
1. [https://carbondesignsystem.com/elements/typography/overview/](https://carbondesignsystem.com/elements/typography/overview/)
148-
2. [https://canvas.workday.com/styles/tokens/type](https://canvas.workday.com/styles/tokens/type)
149-
3. [https://atlassian.design/foundations/typography-beta](https://atlassian.design/foundations/typography-beta)
150-
151-
---
152-
153131
## Color
154132

155133
The PyData Sphinx theme uses a well-defined color palette to ensure consistency,
@@ -179,12 +157,29 @@ are provided for success, errors, warnings, and information.
179157
Using these colors as named ensures users can easily understand system feedback
180158
through visual cues.
181159

182-
### Relevant Links
160+
## Relevant Links
183161

184-
For further reference, you can access the following resources related to colors
185-
in the PyData Sphinx theme:
162+
For further reference, you can access the following resources related to the
163+
color and typography in the PyData Sphinx theme:
186164

187-
1. **GitHub Repository:** You find all the PyData Sphinx theme colors in the
188-
[`color.scss` file](https://github.com/pydata/pydata-sphinx-theme/blob/main/src/pydata_sphinx_theme/assets/styles/variables/_color.scss)
189-
2. **Figma Design File:** For specific color codes and detailed use cases,
165+
1. **GitHub Repository:** The source code for the PyData Sphinx theme is available on GitHub.
166+
1. You can find the specific file that defines the typography settings,
167+
including font stacks, sizes, and weights in the
168+
[`fonts.scss` file](https://github.com/pydata/pydata-sphinx-theme/blob/main/src/pydata_sphinx_theme/assets/styles/variables/_fonts.scss).
169+
2. You can find all the PyData Sphinx theme colors in the
170+
[`color.scss` file](https://github.com/pydata/pydata-sphinx-theme/blob/main/src/pydata_sphinx_theme/assets/styles/variables/_color.scss)
171+
2. **Figma Design File:** The Figma file contains the visual design and specifications
172+
for the typography styles, including font sizes, line heights,
173+
and spacing used throughout the theme. It also includes our color palette and its use cases, as well as details on interactive components and their states.
174+
You can access it [through this link to the Figma file][figma-library].
175+
176+
### References
177+
178+
1. [https://carbondesignsystem.com/elements/typography/overview/](https://carbondesignsystem.com/elements/typography/overview/)
179+
2. [https://canvas.workday.com/styles/tokens/type](https://canvas.workday.com/styles/tokens/type)
180+
3. [https://atlassian.design/foundations/typography-beta](https://atlassian.design/foundations/typography-beta)
190181
refer to the [Figma Design File](https://www.figma.com/design/BHkBFxg1Qg0h5RApUw1ZrR/PyData-Design-System---Ongoing?node-id=2-160).
182+
183+
<!-- reusable links -->
184+
185+
[figma-library]: https://www.figma.com/community/file/1443191723065200671

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,28 @@ h1 {
7777

7878
margin-top: 0;
7979
font-size: var(--pst-font-size-h1);
80-
color: var(--pst-heading-color);
80+
color: var(--pst-color-heading);
8181
}
8282

8383
h2 {
8484
@extend %heading-style;
8585

8686
font-size: var(--pst-font-size-h2);
87-
color: var(--pst-heading-color);
87+
color: var(--pst-color-heading);
8888
}
8989

9090
h3 {
9191
@extend %heading-style;
9292

9393
font-size: var(--pst-font-size-h3);
94-
color: var(--pst-heading-color);
94+
color: var(--pst-color-heading);
9595
}
9696

9797
h4 {
9898
@extend %heading-style;
9999

100100
font-size: var(--pst-font-size-h4);
101-
color: var(--pst-heading-color);
101+
color: var(--pst-color-heading);
102102
}
103103

104104
h5 {
@@ -168,6 +168,7 @@ pre {
168168

169169
// the back to top btn
170170
#pst-back-to-top {
171+
// zindex-tooltip comes from Bootstrap https://getbootstrap.com/docs/5.2/layout/z-index/
171172
z-index: $zindex-tooltip;
172173
position: fixed;
173174
display: none;

src/pydata_sphinx_theme/assets/styles/extensions/_sphinx_design.scss

+3-4
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,18 @@ html[data-theme="light"] {
151151
.bd-content .sd-card {
152152
border: 1px solid var(--pst-color-border);
153153

154-
// TODO - --pst-color-panel-background is not defined... where is this coming from?
155154
.sd-card-header {
156-
background-color: var(--pst-color-panel-background);
155+
background-color: var(--pst-color-on-background);
157156
border-bottom: 1px solid var(--pst-color-border);
158157
}
159158

160159
.sd-card-footer {
161-
background-color: var(--pst-color-panel-background);
160+
background-color: var(--pst-color-on-background);
162161
border-top: 1px solid var(--pst-color-border);
163162
}
164163

165164
.sd-card-body {
166-
background-color: var(--pst-color-panel-background);
165+
background-color: var(--pst-color-on-background);
167166
}
168167

169168
// Focus ring for link-cards

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,6 @@ $pst-semantic-colors: (
182182
"light": #{map-deep-get($color-palette, "gray", "600")},
183183
"dark": #{map-deep-get($color-palette, "gray", "400")},
184184
),
185-
"heading-color": (
186-
"light": #{$foundation-white},
187-
"dark": #{$foundation-black},
188-
),
189185
"shadow": (
190186
"light": rgba(0, 0, 0, 0.1),
191187
"dark": rgba(0, 0, 0, 0.2),
@@ -290,6 +286,7 @@ $pst-semantic-colors: (
290286

291287
// assign the "duplicate" colors (ones that just reference other variables)
292288
& {
289+
--pst-color-heading: var(--pst-color-text-base);
293290
--pst-color-link: var(--pst-color-primary);
294291
--pst-color-link-hover: var(--pst-color-secondary);
295292
--pst-color-table-outer-border: var(--pst-color-surface);

0 commit comments

Comments
 (0)