Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Commit 4ca791c

Browse files
Add neutral color scale documentation (#826)
* draft * add images * edits * five * Update content/foundations/color/base-scales.mdx * Update content/foundations/color/base-scales.mdx Co-authored-by: Eric Bailey <[email protected]> * updates * numbers are hard * tiny edit --------- Co-authored-by: Eric Bailey <[email protected]>
1 parent 4b58b11 commit 4ca791c

File tree

2 files changed

+1150
-628
lines changed

2 files changed

+1150
-628
lines changed

content/foundations/color/base-scales.mdx

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,74 @@ description:
44
Primer base color scales makeup the foundation for all UI color considerations.
55
---
66

7+
## Neutral color scales
8+
9+
<img
10+
width="960"
11+
alt="Two neutral scales stacked on top of each other labeled from 0 to 11. The top scale is the light scale, which starts with white and ends with black. The bottom scale is the dark scale, which starts with black and ends with white."
12+
src="https://github.com/user-attachments/assets/34d35d01-3422-465b-bd64-4f7cb2dba0d4"
13+
/>
14+
15+
Primer's neutral scales offer shades of gray between 0 and 13, including white and black. There are two versions of the neutral scale: light, and dark.
16+
17+
The light and dark scale directions are inverted, with the light scale starting with white and the dark scale starting with black. By inverting the scales, light and dark themes are able to share many of the same functional color tokens without custom overrides.
18+
19+
<img
20+
width="960"
21+
alt="A split view of how muted text colors reference the same base scale color in both light and dark themes."
22+
src="https://github.com/user-attachments/assets/7e0de1f9-619b-4378-b6ea-8842392ddffe"
23+
/>
24+
25+
### Background
26+
27+
The first six steps of the neutral scales are typically used for background colors. The two most commonly used background colors are `bgColor-default` and `bgColor-muted`. All contrast values for text and borders are calculated against `bgColor-muted` to ensure proper contrast ratios for both `muted` and `default`.
28+
29+
<img
30+
width="960"
31+
alt="Two neutral scales stacked on top of each other labelled with background, border, and text to show how the scales are used for different UI elements. In this graphic the background portion is highlighted."
32+
src="https://github.com/user-attachments/assets/c770498b-50e9-4b28-9e16-d7ae513ba8c1"
33+
/>
34+
35+
For control components with state, the scale accommodates rest, hover, and active.
36+
37+
<img
38+
width="960"
39+
alt="A split view showing how neutral scale colors are used for the default button background in both light and dark themes."
40+
src="https://github.com/user-attachments/assets/d686e7fa-55c9-4c8c-bc02-720b48153d8d"
41+
/>
42+
43+
### Borders and dividers
44+
45+
Steps 7 and 8 are typically used for borders and dividers in the default light/dark themes. Step 8 is considered the minimum contrast value for interactive control borders against `bgColor-muted`.
46+
47+
<img
48+
width="960"
49+
alt="Two neutral scales stacked on top of each other labelled with background, border, and text to show how the scales are used for different UI elements. In this graphic the border portion is highlighted."
50+
src="https://github.com/user-attachments/assets/af8c453c-c3ae-4e7c-9833-c23d988b4cac"
51+
/>
52+
53+
### Text and icons
54+
55+
Steps 9 and 10 are typically used for text and icons. Step 9 is considered the minimum contrast value for text against steps 0 through 4, while 10 meets the minimum against 5 and 6.
56+
57+
<img
58+
width="960"
59+
alt="Two neutral scales stacked on top of each other labelled with background, border, and text to show how the scales are used for different UI elements. In this graphic the text portion is highlighted."
60+
src="https://github.com/user-attachments/assets/dd0f077a-8e83-44e8-a182-8e8e765a864b"
61+
/>
62+
63+
### Adjusting contrast
64+
65+
Contrast levels can be adjusted by moving up or down the scale. For example, the light high contrast theme utilizes steps 2 through 7 for backgrounds, 10 for borders, and 11 to 13 for text.
66+
67+
For high contrast themes, the goal is to hit a minimum of 7:1 for most text and interactive elements. If a softer background color must be used, make use of borders around elements to increase contrast.
68+
69+
<img
70+
width="960"
71+
alt="The light color scale is duplicated and labeled to show how its used for UI elements between light and light high contrast themes."
72+
src="https://github.com/user-attachments/assets/3f3b24b1-49cf-4b00-af96-dd41dba8a09d"
73+
/>
74+
775
## All color scales
876

977
<Note>Base color values should only be used to construct functional and component/pattern design tokens, never used directly in code</Note>

0 commit comments

Comments
 (0)