@primer/primitives 11.4.1-rc.eb8ee149 → 11.5.0-rc.14eaeb12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN_TOKENS_GUIDE.md +185 -0
- package/DESIGN_TOKENS_SPEC.md +136 -8
- package/dist/build/formats/jsonFigma.js +8 -1
- package/dist/build/formats/markdownLlmGuidelines.js +349 -0
- package/dist/build/schemas/borderToken.d.ts +61 -5
- package/dist/build/schemas/borderToken.js +2 -1
- package/dist/build/schemas/colorToken.d.ts +639 -30
- package/dist/build/schemas/colorToken.js +3 -2
- package/dist/build/schemas/colorW3cValue.d.ts +28 -0
- package/dist/build/schemas/colorW3cValue.js +42 -0
- package/dist/build/schemas/cubicBezierToken.d.ts +1 -1
- package/dist/build/schemas/dimensionToken.d.ts +9 -2
- package/dist/build/schemas/dimensionValue.d.ts +12 -1
- package/dist/build/schemas/dimensionValue.js +10 -13
- package/dist/build/schemas/durationToken.d.ts +8 -2
- package/dist/build/schemas/durationValue.d.ts +11 -1
- package/dist/build/schemas/durationValue.js +13 -3
- package/dist/build/schemas/fontFamilyToken.d.ts +1 -1
- package/dist/build/schemas/fontWeightToken.d.ts +1 -1
- package/dist/build/schemas/gradientToken.d.ts +23 -2
- package/dist/build/schemas/gradientToken.js +2 -1
- package/dist/build/schemas/numberToken.d.ts +1 -1
- package/dist/build/schemas/shadowToken.d.ts +1751 -127
- package/dist/build/schemas/shadowToken.js +8 -2
- package/dist/build/schemas/stringToken.d.ts +1 -1
- package/dist/build/schemas/stringToken.js +1 -1
- package/dist/build/schemas/tokenType.d.ts +1 -1
- package/dist/build/schemas/transitionToken.d.ts +15 -3
- package/dist/build/schemas/typographyToken.d.ts +19 -5
- package/dist/build/schemas/typographyToken.js +1 -1
- package/dist/build/schemas/validTokenType.d.ts +1 -1
- package/dist/build/schemas/validTokenType.js +1 -1
- package/dist/build/schemas/viewportRangeToken.d.ts +1 -1
- package/dist/build/transformers/borderToCss.js +19 -1
- package/dist/build/transformers/colorAlphaToCss.js +6 -3
- package/dist/build/transformers/colorToHex.js +5 -2
- package/dist/build/transformers/colorToRgbAlpha.js +5 -2
- package/dist/build/transformers/colorToRgbaFloat.js +5 -0
- package/dist/build/transformers/dimensionToPixelUnitless.d.ts +3 -2
- package/dist/build/transformers/dimensionToPixelUnitless.js +22 -26
- package/dist/build/transformers/dimensionToRem.d.ts +2 -1
- package/dist/build/transformers/dimensionToRem.js +21 -22
- package/dist/build/transformers/dimensionToRemPxArray.d.ts +2 -1
- package/dist/build/transformers/dimensionToRemPxArray.js +21 -22
- package/dist/build/transformers/durationToCss.d.ts +2 -1
- package/dist/build/transformers/durationToCss.js +19 -12
- package/dist/build/transformers/gradientToCss.js +2 -1
- package/dist/build/transformers/shadowToCss.js +15 -1
- package/dist/build/transformers/utilities/normalizeColorValue.d.ts +23 -0
- package/dist/build/transformers/utilities/normalizeColorValue.js +74 -0
- package/dist/build/transformers/utilities/parseDimension.d.ts +12 -0
- package/dist/build/transformers/utilities/parseDimension.js +31 -0
- package/dist/build/types/borderTokenValue.d.ts +5 -2
- package/dist/build/types/dimensionTokenValue.d.ts +9 -0
- package/dist/build/types/shadowTokenValue.d.ts +8 -5
- package/dist/css/base/motion/motion.css +1 -1
- package/dist/css/functional/size/radius.css +1 -1
- package/dist/css/functional/size/size-coarse.css +1 -0
- package/dist/css/functional/size/size-fine.css +1 -0
- package/dist/css/functional/size/size.css +5 -0
- package/dist/css/functional/themes/dark-colorblind-high-contrast.css +42 -30
- package/dist/css/functional/themes/dark-colorblind.css +42 -30
- package/dist/css/functional/themes/dark-dimmed-high-contrast.css +42 -30
- package/dist/css/functional/themes/dark-dimmed.css +42 -30
- package/dist/css/functional/themes/dark-high-contrast.css +42 -30
- package/dist/css/functional/themes/dark-tritanopia-high-contrast.css +42 -30
- package/dist/css/functional/themes/dark-tritanopia.css +42 -30
- package/dist/css/functional/themes/dark.css +42 -30
- package/dist/css/functional/themes/light-colorblind-high-contrast.css +42 -30
- package/dist/css/functional/themes/light-colorblind.css +42 -30
- package/dist/css/functional/themes/light-high-contrast.css +42 -30
- package/dist/css/functional/themes/light-tritanopia-high-contrast.css +42 -30
- package/dist/css/functional/themes/light-tritanopia.css +42 -30
- package/dist/css/functional/themes/light.css +42 -30
- package/dist/docs/base/motion/motion.json +96 -24
- package/dist/docs/base/size/size.json +76 -19
- package/dist/docs/base/typography/typography.json +24 -6
- package/dist/docs/functional/size/border.json +26 -11
- package/dist/docs/functional/size/breakpoints.json +24 -6
- package/dist/docs/functional/size/radius.json +18 -6
- package/dist/docs/functional/size/size-coarse.json +55 -2
- package/dist/docs/functional/size/size-fine.json +55 -2
- package/dist/docs/functional/size/size.json +195 -15
- package/dist/docs/functional/themes/dark-colorblind-high-contrast.json +3921 -714
- package/dist/docs/functional/themes/dark-colorblind.json +3911 -712
- package/dist/docs/functional/themes/dark-dimmed-high-contrast.json +3774 -547
- package/dist/docs/functional/themes/dark-dimmed.json +3801 -554
- package/dist/docs/functional/themes/dark-high-contrast.json +3926 -715
- package/dist/docs/functional/themes/dark-tritanopia-high-contrast.json +3936 -717
- package/dist/docs/functional/themes/dark-tritanopia.json +3769 -546
- package/dist/docs/functional/themes/dark.json +3920 -713
- package/dist/docs/functional/themes/light-colorblind-high-contrast.json +3780 -553
- package/dist/docs/functional/themes/light-colorblind.json +3767 -548
- package/dist/docs/functional/themes/light-high-contrast.json +3785 -554
- package/dist/docs/functional/themes/light-tritanopia-high-contrast.json +3785 -554
- package/dist/docs/functional/themes/light-tritanopia.json +3777 -550
- package/dist/docs/functional/themes/light.json +3782 -551
- package/dist/docs/functional/typography/typography.json +8 -2
- package/dist/fallbacks/base/motion/motion.json +48 -12
- package/dist/fallbacks/functional/size/size-coarse.json +2 -1
- package/dist/fallbacks/functional/size/size-fine.json +2 -1
- package/dist/fallbacks/functional/size/size.json +5 -0
- package/dist/figma/dimension/dimension.json +56 -1
- package/dist/figma/themes/dark-colorblind.json +49 -1
- package/dist/figma/themes/dark-dimmed.json +51 -3
- package/dist/figma/themes/dark-high-contrast.json +49 -1
- package/dist/figma/themes/dark-tritanopia.json +49 -1
- package/dist/figma/themes/dark.json +49 -1
- package/dist/figma/themes/light-colorblind.json +53 -5
- package/dist/figma/themes/light-high-contrast.json +53 -5
- package/dist/figma/themes/light-tritanopia.json +53 -5
- package/dist/figma/themes/light.json +53 -5
- package/dist/internalCss/dark-colorblind-high-contrast.css +42 -30
- package/dist/internalCss/dark-colorblind.css +42 -30
- package/dist/internalCss/dark-dimmed-high-contrast.css +42 -30
- package/dist/internalCss/dark-dimmed.css +42 -30
- package/dist/internalCss/dark-high-contrast.css +42 -30
- package/dist/internalCss/dark-tritanopia-high-contrast.css +42 -30
- package/dist/internalCss/dark-tritanopia.css +42 -30
- package/dist/internalCss/dark.css +42 -30
- package/dist/internalCss/light-colorblind-high-contrast.css +42 -30
- package/dist/internalCss/light-colorblind.css +42 -30
- package/dist/internalCss/light-high-contrast.css +42 -30
- package/dist/internalCss/light-tritanopia-high-contrast.css +42 -30
- package/dist/internalCss/light-tritanopia.css +42 -30
- package/dist/internalCss/light.css +42 -30
- package/dist/styleLint/base/motion/motion.json +96 -24
- package/dist/styleLint/base/size/size.json +76 -19
- package/dist/styleLint/base/typography/typography.json +30 -12
- package/dist/styleLint/functional/size/border.json +27 -12
- package/dist/styleLint/functional/size/breakpoints.json +24 -6
- package/dist/styleLint/functional/size/radius.json +19 -7
- package/dist/styleLint/functional/size/size-coarse.json +60 -7
- package/dist/styleLint/functional/size/size-fine.json +60 -7
- package/dist/styleLint/functional/size/size.json +246 -66
- package/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json +4060 -733
- package/dist/styleLint/functional/themes/dark-colorblind.json +4050 -731
- package/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json +3914 -567
- package/dist/styleLint/functional/themes/dark-dimmed.json +3941 -574
- package/dist/styleLint/functional/themes/dark-high-contrast.json +4065 -734
- package/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json +4075 -736
- package/dist/styleLint/functional/themes/dark-tritanopia.json +4079 -736
- package/dist/styleLint/functional/themes/dark.json +4059 -732
- package/dist/styleLint/functional/themes/light-colorblind-high-contrast.json +4091 -744
- package/dist/styleLint/functional/themes/light-colorblind.json +4078 -739
- package/dist/styleLint/functional/themes/light-high-contrast.json +4096 -745
- package/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json +4096 -745
- package/dist/styleLint/functional/themes/light-tritanopia.json +4088 -741
- package/dist/styleLint/functional/themes/light.json +4093 -742
- package/dist/styleLint/functional/typography/typography.json +28 -22
- package/package.json +5 -4
- package/src/tokens/base/color/dark/dark.dimmed.json5 +405 -81
- package/src/tokens/base/color/dark/dark.high-contrast.json5 +405 -81
- package/src/tokens/base/color/dark/dark.json5 +475 -95
- package/src/tokens/base/color/dark/display-dark.json5 +960 -192
- package/src/tokens/base/color/light/display-light.json5 +960 -192
- package/src/tokens/base/color/light/light.high-contrast.json5 +405 -81
- package/src/tokens/base/color/light/light.json5 +475 -95
- package/src/tokens/base/motion/timing.json5 +12 -12
- package/src/tokens/base/size/size.json5 +194 -194
- package/src/tokens/base/typography/typography.json5 +6 -6
- package/src/tokens/component/avatar.json5 +72 -44
- package/src/tokens/component/button.json5 +1846 -1191
- package/src/tokens/component/reactionButton.json5 +20 -4
- package/src/tokens/functional/border/border.json5 +33 -2
- package/src/tokens/functional/color/bgColor.json5 +18 -2
- package/src/tokens/functional/color/borderColor.json5 +8 -1
- package/src/tokens/functional/color/control.json5 +160 -32
- package/src/tokens/functional/color/display.json5 +7 -0
- package/src/tokens/functional/color/fgColor.json5 +13 -1
- package/src/tokens/functional/color/syntax.json5 +24 -2
- package/src/tokens/functional/shadow/shadow.json5 +1254 -163
- package/src/tokens/functional/size/border.json5 +8 -8
- package/src/tokens/functional/size/breakpoints.json5 +6 -6
- package/src/tokens/functional/size/radius.json5 +5 -5
- package/src/tokens/functional/size/size-coarse.json5 +15 -0
- package/src/tokens/functional/size/size-fine.json5 +15 -0
- package/src/tokens/functional/size/size.json5 +65 -15
- package/src/tokens/functional/typography/typography.json5 +8 -4
- package/dist/build/parsers/index.d.ts +0 -1
- package/dist/build/parsers/index.js +0 -1
- package/dist/build/parsers/w3cJsonParser.d.ts +0 -6
- package/dist/build/parsers/w3cJsonParser.js +0 -25
- package/dist/removed/testing.json5 +0 -4
- package/guidelines/color.llm.md +0 -16
- package/guidelines/guidelines.llm.md +0 -34
- package/guidelines/motion.llm.md +0 -41
- package/guidelines/spacing.llm.md +0 -20
- package/guidelines/typography.llm.md +0 -14
- package/src/tokens/removed/testing.json5 +0 -4
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Design Tokens Master Guide
|
|
2
|
+
|
|
3
|
+
> Metadata: This file defines the Logic and Rules for the design system. For individual token definitions and raw values, refer to DESIGN_TOKENS_SPEC.md.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Core Rule
|
|
8
|
+
|
|
9
|
+
**You are a CSS expert. Never use raw values (hex, px, etc.). Only use semantic tokens.**
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Logic Matrix: Color Pairings
|
|
14
|
+
|
|
15
|
+
| Background Token | Foreground Token | Notes |
|
|
16
|
+
| ---------------------- | ---------------------- | ------------------------- |
|
|
17
|
+
| `--bgColor-*-emphasis` | `--fgColor-onEmphasis` | MUST pair |
|
|
18
|
+
| `--bgColor-*-muted` | `--fgColor-{semantic}` | MUST use semantic fg |
|
|
19
|
+
| `--bgColor-default` | `--fgColor-default` | Standard pairing |
|
|
20
|
+
| `--bgColor-muted` | `--fgColor-default` | NEVER use `fgColor-muted` |
|
|
21
|
+
|
|
22
|
+
**Contrast Requirements:**
|
|
23
|
+
|
|
24
|
+
| Context | Ratio | Standard |
|
|
25
|
+
| --------------- | ----- | -------- |
|
|
26
|
+
| Normal text | 4.5:1 | WCAG AA |
|
|
27
|
+
| Large text / UI | 3:1 | WCAG AA |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Pattern Compression
|
|
32
|
+
|
|
33
|
+
### Control Tokens
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
--control-[size]-[property]
|
|
37
|
+
├── size: xsmall | small | medium | large | xlarge
|
|
38
|
+
└── property: size | paddingInline-[density] | paddingBlock
|
|
39
|
+
└── density: condensed | normal | spacious
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Stack Tokens
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
--stack-[property]-[size]
|
|
46
|
+
├── property: gap | padding
|
|
47
|
+
└── size: condensed | normal | spacious
|
|
48
|
+
|
|
49
|
+
--controlStack-[size]-gap-[density]
|
|
50
|
+
├── size: small | medium | large
|
|
51
|
+
└── density: condensed | auto | spacious
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Typography Tokens
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
--text-[role]-shorthand-[size]
|
|
58
|
+
├── role: display | title | body | subtitle | caption | codeBlock | codeInline
|
|
59
|
+
└── size: small | medium | large
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Keyword Enforcement (RFC 2119)
|
|
65
|
+
|
|
66
|
+
### Motion
|
|
67
|
+
|
|
68
|
+
| Keyword | Rule |
|
|
69
|
+
| ------- | -------------------------------------------------------------- |
|
|
70
|
+
| MUST | Use motion for interactive state changes (hover, focus, press) |
|
|
71
|
+
| MUST | Keep animations ≤300ms for UI interactions |
|
|
72
|
+
| MUST | Respect `prefers-reduced-motion` media query |
|
|
73
|
+
| MUST | Provide instant alternatives when motion is reduced |
|
|
74
|
+
| SHOULD | Use 100-200ms for micro-interactions |
|
|
75
|
+
| SHOULD | Use 200-300ms for state changes |
|
|
76
|
+
| NEVER | Exceed 500ms for UI interactions |
|
|
77
|
+
| NEVER | Use motion purely for decoration |
|
|
78
|
+
| NEVER | Create indefinitely looping motion without user control |
|
|
79
|
+
| NEVER | Rely solely on motion to convey information |
|
|
80
|
+
|
|
81
|
+
### Typography
|
|
82
|
+
|
|
83
|
+
| Keyword | Rule |
|
|
84
|
+
| ---------- | --------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| **MUST** | Use **shorthand** tokens (e.g., `font: var(...)`) to ensure `line-height` and `font-weight` are synchronized. |
|
|
86
|
+
| **MUST** | Use `text-codeBlock` for multi-line blocks and `text-codeInline` for inline spans. |
|
|
87
|
+
| **SHOULD** | Match the token to the **semantic role** (e.g., use `title` tokens for headers, not just a large `body` token). |
|
|
88
|
+
| **SHOULD** | Downgrade one size level for mobile viewports (e.g., `title-large` → `title-medium`). |
|
|
89
|
+
| **NEVER** | Use individual `font-size` or `line-height` tokens if a shorthand variant is available. |
|
|
90
|
+
| **NEVER** | Use `text-caption-shorthand` for multi-line body text (accessibility/readability failure). |
|
|
91
|
+
|
|
92
|
+
### Spacing
|
|
93
|
+
|
|
94
|
+
| Keyword | Rule |
|
|
95
|
+
| ------- | ------------------------------------------- |
|
|
96
|
+
| MUST | Use control tokens for interactive elements |
|
|
97
|
+
| MUST | Use stack tokens for layout spacing |
|
|
98
|
+
| MUST | Match padding density to control's purpose |
|
|
99
|
+
| SHOULD | Use `medium` size as default |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Decision Tree: Easing Selection
|
|
104
|
+
|
|
105
|
+
1. Is element entering/exiting viewport? → ease-out (default)
|
|
106
|
+
2. Is element moving/morphing on screen? → ease-in-out
|
|
107
|
+
3. Is this a hover state change? → ease
|
|
108
|
+
4. Is this constant motion (loaders)? → linear
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Golden Example: Reference Component
|
|
113
|
+
|
|
114
|
+
```css
|
|
115
|
+
/* Button: All 5 interactive states with correct token usage */
|
|
116
|
+
.btn {
|
|
117
|
+
/* Base styles */
|
|
118
|
+
background-color: var(--control-bgColor-rest);
|
|
119
|
+
color: var(--fgColor-default);
|
|
120
|
+
border: none;
|
|
121
|
+
border-radius: var(--borderRadius-medium);
|
|
122
|
+
padding-block: var(--control-medium-paddingBlock);
|
|
123
|
+
padding-inline: var(--control-medium-paddingInline-normal);
|
|
124
|
+
font: var(--text-body-shorthand-medium);
|
|
125
|
+
cursor: pointer;
|
|
126
|
+
|
|
127
|
+
/* Motion: MUST be <300ms */
|
|
128
|
+
transition:
|
|
129
|
+
background-color 150ms ease,
|
|
130
|
+
box-shadow 150ms ease,
|
|
131
|
+
transform 100ms ease;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* State: Hover */
|
|
135
|
+
.btn:hover {
|
|
136
|
+
background-color: var(--control-bgColor-hover);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* State: Focus-visible (MUST use :focus-visible, not :focus) */
|
|
140
|
+
.btn:focus-visible {
|
|
141
|
+
outline: var(--focus-outline);
|
|
142
|
+
outline-offset: var(--outline-focus-offset);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* State: Active/Pressed */
|
|
146
|
+
.btn:active {
|
|
147
|
+
background-color: var(--control-bgColor-active);
|
|
148
|
+
transform: scale(0.98);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* State: Disabled */
|
|
152
|
+
.btn:disabled {
|
|
153
|
+
background-color: var(--bgColor-disabled);
|
|
154
|
+
color: var(--fgColor-disabled);
|
|
155
|
+
cursor: not-allowed;
|
|
156
|
+
opacity: 1; /* NEVER use opacity for disabled */
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Accessibility: MUST respect reduced motion */
|
|
160
|
+
@media (prefers-reduced-motion: reduce) {
|
|
161
|
+
.btn {
|
|
162
|
+
transition: none;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Interactive States Checklist
|
|
170
|
+
|
|
171
|
+
All interactive elements MUST define:
|
|
172
|
+
|
|
173
|
+
| State | Selector | Required |
|
|
174
|
+
| -------- | -------------------------------------- | ------------------------ |
|
|
175
|
+
| Rest | `.element` | ✓ |
|
|
176
|
+
| Hover | `:hover` | ✓ |
|
|
177
|
+
| Focus | `:focus-visible` | ✓ (NEVER `:focus` alone) |
|
|
178
|
+
| Active | `:active` | ✓ |
|
|
179
|
+
| Disabled | `:disabled` / `[aria-disabled="true"]` | ✓ |
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Hallucination Guard
|
|
184
|
+
|
|
185
|
+
> **If you suggest a token name not found in this spec or the system, suffix it with `/* check-token */`.**
|
package/DESIGN_TOKENS_SPEC.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Primer Design Token Guidelines
|
|
2
2
|
|
|
3
|
+
> Metadata: This file is a Dictionary of tokens. For usage rules, contrast requirements, and motion logic, refer to DESIGN_TOKENS_GUIDE.md.
|
|
4
|
+
|
|
3
5
|
Reference for using GitHub Primer design tokens.
|
|
4
6
|
|
|
5
7
|
## Legend
|
|
@@ -36,6 +38,10 @@ Background color tokens for surfaces, containers, and UI elements.
|
|
|
36
38
|
- `bgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-emphasis`
|
|
37
39
|
- `bgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]-muted`
|
|
38
40
|
|
|
41
|
+
### bgColor-black
|
|
42
|
+
Pure black background
|
|
43
|
+
**R:** Avoid using raw black. Use semantic alternatives: bg.emphasis for dark backgrounds, bg.inverse for inverted contexts. Raw black/white ignore theme preferences and accessibility settings.
|
|
44
|
+
|
|
39
45
|
### bgColor-default
|
|
40
46
|
Default background color for pages and main content areas
|
|
41
47
|
**U:** card-background, main-content, page-background
|
|
@@ -81,6 +87,10 @@ Fully transparent background
|
|
|
81
87
|
**U:** ghost-button, icon-button, overlay-trigger
|
|
82
88
|
**R:** Use for ghost/icon buttons or when element should blend with parent. Ensure sufficient contrast for interactive states.
|
|
83
89
|
|
|
90
|
+
### bgColor-white
|
|
91
|
+
Pure white background
|
|
92
|
+
**R:** Avoid using raw white. Use semantic alternatives: bg.default for standard backgrounds, bg.inset for recessed areas, or bg.inverse for inverted contexts. Raw black/white ignore theme preferences and accessibility settings.
|
|
93
|
+
|
|
84
94
|
## Border
|
|
85
95
|
|
|
86
96
|
Composite border tokens combining color, width, and style.
|
|
@@ -91,6 +101,12 @@ Composite border tokens combining color, width, and style.
|
|
|
91
101
|
|
|
92
102
|
**Tokens:** border-default, border-disabled, border-emphasis, border-muted, border-transparent
|
|
93
103
|
|
|
104
|
+
### draft
|
|
105
|
+
**Tokens:** border-draft-emphasis, border-draft-muted
|
|
106
|
+
|
|
107
|
+
### border-translucent
|
|
108
|
+
Semi-transparent border shorthand for overlays and layered elements. Border-specific token — no bgColor-translucent counterpart exists by design.
|
|
109
|
+
|
|
94
110
|
## Border Colors
|
|
95
111
|
|
|
96
112
|
Border color tokens for boundaries, dividers, and outlines.
|
|
@@ -130,10 +146,15 @@ Subtle border for secondary elements and light separators
|
|
|
130
146
|
**R:** Use for subtle borders and separators. Less prominent than border.default.
|
|
131
147
|
|
|
132
148
|
### borderColor-translucent
|
|
133
|
-
Semi-transparent border for overlays and layered elements
|
|
149
|
+
Semi-transparent border for overlays and layered elements. Border-specific token — no bgColor-translucent counterpart exists by design.
|
|
134
150
|
**U:** overlay-border, translucent-border
|
|
135
151
|
**R:** Use for semi-transparent borders on overlays. Works well with translucent backgrounds.
|
|
136
152
|
|
|
153
|
+
### borderColor-transparent
|
|
154
|
+
Fully transparent border
|
|
155
|
+
**U:** border-color, border-styling
|
|
156
|
+
**R:** These are COLOR-ONLY tokens (resolve to a hex value like #cf222e). Use for the CSS `border-color` property. Do NOT use for the CSS `border` shorthand — use border.* tokens instead.
|
|
157
|
+
|
|
137
158
|
## Border Radius
|
|
138
159
|
|
|
139
160
|
Corner radius tokens for rounded elements.
|
|
@@ -144,7 +165,7 @@ Use this border radius for pill shaped elements
|
|
|
144
165
|
**R:** Use for avatars and pill-shaped elements. Do NOT use for rectangular containers.
|
|
145
166
|
|
|
146
167
|
### borderRadius-large
|
|
147
|
-
Large border radius (12px). Use for larger containers, dialogs, or when more visual softness is desired.
|
|
168
|
+
Large border radius (12px). Use for larger containers, dialogs, or when more visual softness is desired.
|
|
148
169
|
**U:** card, dialog, modal
|
|
149
170
|
**R:** Recommended for dialogs and modals.
|
|
150
171
|
|
|
@@ -167,6 +188,44 @@ Thick 2px border for emphasis. Use for focus indicators, selected states, or to
|
|
|
167
188
|
**U:** emphasis-border, focus-indicator, selected-state
|
|
168
189
|
**R:** MUST use for focus rings on interactive elements. Do NOT use for subtle dividers.
|
|
169
190
|
|
|
191
|
+
## Color
|
|
192
|
+
### ANSI Terminal Colors
|
|
193
|
+
|
|
194
|
+
ANSI terminal color palette for command-line interfaces and terminal emulators. Maps standard ANSI color names to theme-appropriate values.
|
|
195
|
+
|
|
196
|
+
**U:** terminal-output, cli-interface, console-text
|
|
197
|
+
**R:** Use exclusively for terminal/CLI contexts. Do NOT use for general UI—use semantic colors (fgColor, bgColor) instead. These colors follow ANSI naming conventions (black, red, green, yellow, blue, magenta, cyan, white) with bright variants.
|
|
198
|
+
|
|
199
|
+
**Pattern:** `color-ansi-[color]` or `color-ansi-[color]-bright`
|
|
200
|
+
|
|
201
|
+
**Variables:**
|
|
202
|
+
- **color:** black | red | green | yellow | blue | magenta | cyan | white | gray
|
|
203
|
+
- **variant:** default (no suffix) | bright
|
|
204
|
+
|
|
205
|
+
### Syntax Highlighting (prettylights)
|
|
206
|
+
|
|
207
|
+
Syntax highlighting colors for code display. Used by GitHub code rendering (prettylights theme).
|
|
208
|
+
|
|
209
|
+
**U:** code-syntax-highlighting, code-block, inline-code
|
|
210
|
+
**R:** Use exclusively for syntax highlighting in code display contexts. Do NOT use for general UI text or backgrounds. Each token maps to a specific syntax element (comment, keyword, string, etc.).
|
|
211
|
+
|
|
212
|
+
**Pattern:** `color-prettylights-syntax-[element]`
|
|
213
|
+
|
|
214
|
+
**Core elements:** comment, constant, entity, keyword, string, variable
|
|
215
|
+
|
|
216
|
+
**Compound elements:**
|
|
217
|
+
- `brackethighlighter-[angle, unmatched]`
|
|
218
|
+
- `carriage-[return]-[bg, text]`
|
|
219
|
+
- `constant-[other-reference-link]`
|
|
220
|
+
- `entity-[tag]`
|
|
221
|
+
- `invalid-[illegal]-[bg, text]`
|
|
222
|
+
- `markup-[bold, heading, italic, list]`
|
|
223
|
+
- `markup-[changed, deleted, ignored, inserted]-[bg, text]`
|
|
224
|
+
- `meta-[diff-range]`
|
|
225
|
+
- `storage-[modifier-import]`
|
|
226
|
+
- `string-[regexp]`
|
|
227
|
+
- `sublimelinter-[gutter-mark]`
|
|
228
|
+
|
|
170
229
|
## Controls
|
|
171
230
|
|
|
172
231
|
Tokens for interactive controls like buttons, inputs, and selects.
|
|
@@ -174,9 +233,7 @@ Tokens for interactive controls like buttons, inputs, and selects.
|
|
|
174
233
|
**Scale:** Use xsmall/small for dense layouts, medium for default UI, large/xlarge for prominent CTAs.
|
|
175
234
|
|
|
176
235
|
**Size patterns:**
|
|
177
|
-
- `control-[xsmall, small, medium, large, xlarge]-[gap, lineBoxHeight, paddingBlock, paddingInline-normal, size]`
|
|
178
|
-
- `control-[xsmall, medium, large, xlarge]-paddingInline-spacious`
|
|
179
|
-
- `control-[xsmall, small, medium]-paddingInline-condensed`
|
|
236
|
+
- `control-[xsmall, small, medium, large, xlarge]-[gap, lineBoxHeight, paddingBlock, paddingInline-condensed, paddingInline-normal, paddingInline-spacious, size]`
|
|
180
237
|
|
|
181
238
|
**State variants:**
|
|
182
239
|
- `control-checked-[bgColor-active, bgColor-disabled, bgColor-hover, bgColor-rest, borderColor-active, borderColor-disabled, borderColor-hover, borderColor-rest, fgColor-disabled, fgColor-rest]`
|
|
@@ -220,12 +277,40 @@ Colors for toggle switch tracks (the background rail that the knob slides along)
|
|
|
220
277
|
|
|
221
278
|
## Data Visualization
|
|
222
279
|
|
|
223
|
-
|
|
280
|
+
Color tokens for charts, graphs, and diagrams. Use emphasis variants for lines/bars, muted variants for fills.
|
|
224
281
|
|
|
225
|
-
**U:**
|
|
282
|
+
**U:** chart-series, graph-line, bar-fill
|
|
226
283
|
**R:** Use data colors for visualizations only. Do NOT use for semantic meaning (use bg.success/danger instead). When using multiple series, ensure sufficient contrast between adjacent colors. Pair emphasis with muted variants of the same color for cohesive styling.
|
|
227
284
|
|
|
228
|
-
**
|
|
285
|
+
**Pattern:** `data-[color]-color-[variant]`
|
|
286
|
+
|
|
287
|
+
**Variables:**
|
|
288
|
+
- **color:** auburn | blue | brown | coral | gray | green | lemon | lime | olive | orange | pine | pink | plum | purple | red | teal | yellow
|
|
289
|
+
- **variant:** emphasis | muted
|
|
290
|
+
|
|
291
|
+
**Variant usage:**
|
|
292
|
+
- **emphasis:** Lines, bars, borders, data points
|
|
293
|
+
- **muted:** Area fills, backgrounds, subtle regions
|
|
294
|
+
|
|
295
|
+
*Pair emphasis with muted variants of the same color for cohesive chart styling.*
|
|
296
|
+
|
|
297
|
+
## Display Colors
|
|
298
|
+
|
|
299
|
+
Decorative colors for categorization without semantic meaning. Use for labels, tags, avatars, and user-assigned colors. Do NOT use for success/error/warning—use semantic colors instead.
|
|
300
|
+
|
|
301
|
+
**U:** label, tag, avatar
|
|
302
|
+
**R:** Use display colors for arbitrary categorization where the color has no inherent meaning (e.g., project labels, user avatars). For meaningful states like success, error, or warning, use semantic colors instead. Scales 0-2 are lighter (backgrounds), 3-5 are mid-tones, 6-9 are darker (foregrounds/borders).
|
|
303
|
+
|
|
304
|
+
**Pattern:** `display-[color]-[property]`
|
|
305
|
+
|
|
306
|
+
**Variables:**
|
|
307
|
+
- **color:** auburn | blue | brown | coral | cyan | gray | green | indigo | lemon | lime | olive | orange | pine | pink | plum | purple | red | teal | yellow
|
|
308
|
+
- **property:** bgColor-emphasis | bgColor-muted | borderColor-emphasis | borderColor-muted | fgColor
|
|
309
|
+
|
|
310
|
+
**Scale pattern:** `display-[color]-scale-[n]`
|
|
311
|
+
- **n:** 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
|
|
312
|
+
|
|
313
|
+
*Scale 0-2: lighter (backgrounds), 3-5: mid-tones, 6-9: darker (foregrounds/borders)*
|
|
229
314
|
|
|
230
315
|
## Easing
|
|
231
316
|
|
|
@@ -263,6 +348,10 @@ Text and icon color tokens.
|
|
|
263
348
|
**Semantic tokens** (see Semantic Key for meaning):
|
|
264
349
|
- `fgColor-[accent, attention, closed, danger, done, neutral, open, severe, sponsors, success, upsell]`
|
|
265
350
|
|
|
351
|
+
### fgColor-black
|
|
352
|
+
Pure black text
|
|
353
|
+
**R:** Avoid using raw black. Use semantic alternatives: fg.default for standard text, fg.muted for secondary text. Raw black/white ignore theme preferences and accessibility settings.
|
|
354
|
+
|
|
266
355
|
### fgColor-default
|
|
267
356
|
Default text color for primary content and headings
|
|
268
357
|
**U:** body-text, default-text, heading
|
|
@@ -298,6 +387,10 @@ Text color for use on inverse backgrounds
|
|
|
298
387
|
**U:** inverse-text, text-on-inverse
|
|
299
388
|
**R:** Use for text on bg.inverse. Provides appropriate contrast in both themes.
|
|
300
389
|
|
|
390
|
+
### fgColor-white
|
|
391
|
+
Pure white text
|
|
392
|
+
**R:** Avoid using raw white. Use semantic alternatives: fg.onEmphasis for text on dark backgrounds, fg.onInverse for inverted contexts. Raw black/white ignore theme preferences and accessibility settings.
|
|
393
|
+
|
|
301
394
|
## Focus
|
|
302
395
|
|
|
303
396
|
Focus ring and outline tokens for keyboard navigation accessibility.
|
|
@@ -377,11 +470,46 @@ Large floating shadow for modals and dialogs
|
|
|
377
470
|
**U:** dialog, full-screen-overlay, modal
|
|
378
471
|
**R:** MUST use for modals and dialogs. Do NOT use for small floating elements.
|
|
379
472
|
|
|
473
|
+
### shadow-floating-legacy
|
|
474
|
+
Legacy floating shadow for backward compatibility
|
|
475
|
+
**U:** backward-compatibility, legacy-component
|
|
476
|
+
**R:** DEPRECATED: Use shadow-floating-small instead. Only use for maintaining backward compatibility with existing implementations.
|
|
477
|
+
|
|
478
|
+
### shadow-floating-medium
|
|
479
|
+
Medium floating shadow for popovers and action menus
|
|
480
|
+
**U:** action-menu, popover, select-panel
|
|
481
|
+
**R:** Use for medium-sized floating elements like popovers and action menus. More prominent than small but less than dialogs. Do NOT use for full modals.
|
|
482
|
+
|
|
380
483
|
### shadow-floating-small
|
|
381
484
|
Small floating shadow for dropdowns, tooltips, and small overlays
|
|
382
485
|
**U:** dropdown, popover, tooltip
|
|
383
486
|
**R:** Use for small floating elements like dropdowns and tooltips. Do NOT use for modals or dialogs.
|
|
384
487
|
|
|
488
|
+
### shadow-floating-xlarge
|
|
489
|
+
Extra large floating shadow for full-screen overlays and sheets
|
|
490
|
+
**U:** drawer, full-screen-overlay, side-sheet
|
|
491
|
+
**R:** Use for full-screen or near-full-screen overlays like side sheets and drawers. Maximum elevation in the system. Do NOT use for small floating elements.
|
|
492
|
+
|
|
493
|
+
### shadow-inset
|
|
494
|
+
Inset shadow for recessed elements
|
|
495
|
+
**U:** input-field, pressed-button, recessed-area
|
|
496
|
+
**R:** Use for elements that appear pressed or inset into the surface. Commonly used for input fields and wells. Do NOT use for floating elements.
|
|
497
|
+
|
|
498
|
+
### shadow-resting-medium
|
|
499
|
+
Medium resting shadow for cards and elevated surfaces
|
|
500
|
+
**U:** card, elevated-surface, panel
|
|
501
|
+
**R:** Use for cards and content panels that sit above the page surface. Provides moderate elevation without appearing to float. Do NOT use for overlays or modals.
|
|
502
|
+
|
|
503
|
+
### shadow-resting-small
|
|
504
|
+
Small resting shadow for buttons and interactive elements
|
|
505
|
+
**U:** button, clickable-element, interactive-card
|
|
506
|
+
**R:** Use for buttons and small interactive elements at rest. Provides subtle depth and clickable affordance. RECOMMENDED for default button shadows.
|
|
507
|
+
|
|
508
|
+
### shadow-resting-xsmall
|
|
509
|
+
Extra small resting shadow for minimal elevation
|
|
510
|
+
**U:** badge, chip, small-card
|
|
511
|
+
**R:** Use for very subtle elevation on small elements. Provides minimal lift from surface. Do NOT use for interactive elements needing clear affordance.
|
|
512
|
+
|
|
385
513
|
## Spinner
|
|
386
514
|
|
|
387
515
|
Loading spinner size and stroke tokens.
|
|
@@ -35,10 +35,17 @@ const getFigmaType = (type) => {
|
|
|
35
35
|
throw new Error(`Invalid type: ${type}`);
|
|
36
36
|
};
|
|
37
37
|
const shadowToVariables = (name, values, token) => {
|
|
38
|
+
// Helper to extract numeric value from W3C dimension object
|
|
39
|
+
const getDimensionValue = (dim) => {
|
|
40
|
+
if (typeof dim === 'object' && 'value' in dim) {
|
|
41
|
+
return dim.value;
|
|
42
|
+
}
|
|
43
|
+
throw new Error(`Invalid shadow dimension: expected W3C object format, got ${JSON.stringify(dim)}`);
|
|
44
|
+
};
|
|
38
45
|
// floatValue
|
|
39
46
|
const floatValue = (property) => ({
|
|
40
47
|
name: `${name}/${property}`,
|
|
41
|
-
value:
|
|
48
|
+
value: getDimensionValue(values[property]),
|
|
42
49
|
type: 'FLOAT',
|
|
43
50
|
scopes: ['EFFECT_FLOAT'],
|
|
44
51
|
mode,
|