| 1 |
# PyData Sphinx Theme Design System |
| 2 |
|
| 3 |
The Pydata Sphinx Theme is committed to maintaining a theme that supports industry standards; |
| 4 |
the design system must be included. |
| 5 |
Whether choosing how to configure your theme or making changes to the design system itself, |
| 6 |
consider the most recent version of the Web Content Accessibility Guidelines |
| 7 |
(WCAG) to make sure the community continues to support documentation access for everyone. |
| 8 |
|
| 9 |
## Guiding Principles |
| 10 |
|
| 11 |
### Accessibility |
| 12 |
|
| 13 |
Accessibility is at the core of the PyData Sphinx theme. |
| 14 |
All design decisions are made with [WCAG 2.1](https://www.w3.org/TR/WCAG21/) conformance in mind, |
| 15 |
ensuring that the theme is usable by people of all abilities. |
| 16 |
Accessibility is a priority to make the theme inclusive for all users. |
| 17 |
|
| 18 |
### Open Source Collaboration |
| 19 |
|
| 20 |
As an open-source project, collaboration and transparency are key principles: |
| 21 |
|
| 22 |
1. **Clear Guidelines:** All components, color palettes, and typography rules must be documented. |
| 23 |
2. **Open Feedback:** Designers, developers, users and maintainers are encouraged |
| 24 |
to give feedback on the theme, helping to improve its functionality and usability over time. |
| 25 |
If you’d like to provide feedback, please open an issue on the |
| 26 |
[PyData Sphinx Theme GitHub repository.](https://github.com/pydata/pydata-sphinx-theme) |
| 27 |
3. **Community Driven:** The theme grows and evolves based on the needs and |
| 28 |
suggestions of the open-source community. |
| 29 |
|
| 30 |
## Typography |
| 31 |
|
| 32 |
### Typeface |
| 33 |
|
| 34 |
PyData Sphinx uses default system fonts. |
| 35 |
|
| 36 |
### Type Scale |
| 37 |
|
| 38 |
A type scale refers to the multiple by which font sizes increase. |
| 39 |
You can find more about typographic scales at [Typographic Scale](https://designcode.io/typographic-scales). |
| 40 |
For content-heavy websites, a medium contrast scale, which provides balanced |
| 41 |
contrast between heading sizes without overly large jumps, is ideal, |
| 42 |
typically ranging from `1.2x` to `1.33x`. |
| 43 |
|
| 44 |
The PST type scale was updated (August 2024) to improve the accessibility of the |
| 45 |
overall type system and increase visual contrast between the headings. |
| 46 |
The PST type scale uses the Minor Third scale (`1.2x`) with values rounded to the |
| 47 |
nearest even whole number. |
| 48 |
Except for the H4 to H3 transition, all headings have a minimum of a `1.2x` increase, |
| 49 |
which is an improvement over the previous scale. |
| 50 |
|
| 51 |
### Styles |
| 52 |
|
| 53 |
#### Headings |
| 54 |
|
| 55 |
Headings create structure and hierarchy within the content. |
| 56 |
They range from `H1` to `H6`, with each level decreasing in size and importance. |
| 57 |
|
| 58 |
| Style | Size (`px`) | Size (`rem`) | Weight | Use / Notes | |
| 59 |
| :-------- | :---------- | :----------- | :----- | :------------------------------- | |
| 60 |
| Heading 1 | 42 | 2.625 | 600 | Main page titles (use only once) | |
| 61 |
| Heading 2 | 34 | 2.125 | 600 | Section titles | |
| 62 |
| Heading 3 | 28 | 1.750 | 600 | Subsections within H2 | |
| 63 |
| Heading 4 | 24 | 1.500 | 600 | Tertiary level headings | |
| 64 |
| Heading 5 | 20 | 1.250 | 600 | Less prominent headings | |
| 65 |
| Heading 6 | 16 | 1.000 | 600 | Lowest level headings | |
| 66 |
|
| 67 |
Always use headings in logical order (`H1`, `H2`, `H3`, etc.) without skipping levels, |
| 68 |
to help assistive tech such as screen readers interpret the structure of the page. |
| 69 |
Each page should have a single, unique `H1` to effectively define the page's purpose, |
| 70 |
improving search engine optimization (SEO) and accessibility for users who rely |
| 71 |
on assistive tech such as screen readers. |
| 72 |
|
| 73 |
#### Body |
| 74 |
|
| 75 |
Body text serves as the standard style for detailed content. |
| 76 |
It is primarily used for longer, detailed content such as paragraphs, articles, |
| 77 |
and descriptions, but may also apply to other areas such as modals, admonitions |
| 78 |
or sections where longer content needs to be displayed clearly. |
| 79 |
|
| 80 |
| Style | Size (`px`) | Size (`rem`) | Weight | Use / Notes | |
| 81 |
| :---- | :---------- | :----------- | :----- | :--------------------------------- | |
| 82 |
| Body | 16 | 1.000 | 400 | Standard text size for readability | |
| 83 |
|
| 84 |
While there is no absolute minimum text size, for optimum readability, |
| 85 |
body text should be at least `16px`. |
| 86 |
|
| 87 |
#### Links |
| 88 |
|
| 89 |
Links must be styled in a way that makes them visually distinct from regular text. |
| 90 |
All links should be underlined in addition to being color-coded, |
| 91 |
as [color alone should not be used to convey meaning](https://www.w3.org/WAI/WCAG21/Understanding/use-of-color.html). |
| 92 |
|
| 93 |
| Style | Size (`px`) | Size (`rem`) | Weight | Use / Notes | |
| 94 |
| :---- | :---------- | :----------- | :----- | :-------------------------------- | |
| 95 |
| Links | 16 | 1.000 | 400 | Always underlined and color-coded | |
| 96 |
|
| 97 |
Links also have a hover and focus interactive state. |
| 98 |
Hover and focus states should always show a change in color and visual design |
| 99 |
to provide clear feedback for interactive elements. |
| 100 |
|
| 101 |
Links are used to navigate between different pages or sections and to redirect |
| 102 |
readers to external sources. |
| 103 |
They are visually distinct from buttons, which are used to perform actions within |
| 104 |
the current page or context and should not trigger actions like submitting forms |
| 105 |
or toggling components. |
| 106 |
|
| 107 |
#### Code Text |
| 108 |
|
| 109 |
Code text is used to display inline code snippets or larger blocks of code. |
| 110 |
It uses a monospaced font. The theme also includes interactive states for code |
| 111 |
text including links. |
| 112 |
|
| 113 |
### Type Color |
| 114 |
|
| 115 |
Text color plays a crucial role in ensuring that content is legible and accessible. |
| 116 |
In the PyData Sphinx theme, we use a predefined set of colors to ensure readability, |
| 117 |
visual hierarchy, and consistency across different elements. |
| 118 |
Each text color is designed to meet accessibility guidelines, ensuring sufficient |
| 119 |
contrast between text and background. |
| 120 |
|
| 121 |
When using colors in text, ensure that it meets the minimum |
| 122 |
[WCAG color contrast accessibility criterion](https://www.w3.org/WAI/WCAG22/quickref/?versions=2.1#contrast-minimum). |
| 123 |
Color alone should not be used to indicate meaning. |
| 124 |
For example, text that is a link should not be indicated solely by color |
| 125 |
but also with an underline. |
| 126 |
This helps ensure that users who have difficulty distinguishing colors can still identify links. |
| 127 |
Semantic colors (such as for success, warning, or error messages) can be used to |
| 128 |
convey meaning, but color should not be the only indicator. |
| 129 |
Pair these colors with icons or text labels to ensure clarity. |
| 130 |
|
| 131 |
## Color |
| 132 |
|
| 133 |
The PyData Sphinx theme uses a well-defined color palette to ensure consistency, |
| 134 |
readability, and accessibility across the entire design system. |
| 135 |
This color palette is available for both light and dark themes. |
| 136 |
This document explains how to use the theme's color system |
| 137 |
|
| 138 |
### Base Colors |
| 139 |
|
| 140 |
Base colors form the foundation of the theme and are used across primary UI elements |
| 141 |
like buttons, backgrounds, and text. They maintain consistency throughout the interface. |
| 142 |
|
| 143 |
- **Primary**: The main color for major actions and interactive elements. |
| 144 |
- **Secondary**: A supporting color for secondary actions and highlights. |
| 145 |
- **Accent**: An emphasis color used sparingly for highlighting content. |
| 146 |
- **Gray (Neutral)**: Used for typography, borders, and backgrounds. |
| 147 |
- **Foundation Colors**: Black and white base colors used for backgrounds and |
| 148 |
surfaces (for example, cards, containers, modals) in light and dark modes. |
| 149 |
|
| 150 |
Color variables are also documented in the [](../user_guide/styling.rst) section |
| 151 |
of the User Guide. |
| 152 |
|
| 153 |
### Semantic Colors |
| 154 |
|
| 155 |
Semantic colors, colors named for what they represent and how they are used, |
| 156 |
are provided for success, errors, warnings, and information. |
| 157 |
Using these colors as named ensures users can easily understand system feedback |
| 158 |
through visual cues. |
| 159 |
|
| 160 |
## Relevant Links |
| 161 |
|
| 162 |
For further reference, you can access the following resources related to the |
| 163 |
color and typography in the PyData Sphinx theme: |
| 164 |
|
| 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/tree/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) |
| 181 |
refer to the [Figma Design File](https://www.figma.com/community/file/1443191723065200671/pydata-sphinx-theme-design-system). |
| 182 |
|
| 183 |
<!-- reusable links --> |
| 184 |
|
| 185 |
[figma-library]: https://www.figma.com/community/file/1443191723065200671/pydata-sphinx-theme-design-system |