Skip to content

Commit 8ee8bfc

Browse files
committed
Theme: Share a transparent primitive across interactive tokens
Several interactive background tokens (the weak/normal and disabled variants for the neutral, brand, and error tones) repeated the same inline fully-transparent value. Extract it into a shared `primitive.transparent` token and reference it, mirroring how the other disabled tokens already alias primitives. Internal-only: primitives are not emitted as custom properties, so there is no public API or resolved-value change.
1 parent a11beb3 commit 8ee8bfc

2 files changed

Lines changed: 25 additions & 40 deletions

File tree

packages/theme/src/prebuilt/ts/color-tokens.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
*/
55

66
export default {
7+
transparent: [
8+
'background-interactive-brand-weak',
9+
'background-interactive-brand-weak-disabled',
10+
'background-interactive-error',
11+
'background-interactive-error-disabled',
12+
'background-interactive-error-weak',
13+
'background-interactive-error-weak-disabled',
14+
'background-interactive-neutral-weak',
15+
'background-interactive-neutral-weak-disabled',
16+
],
717
'primary-bgFill1': [ 'background-interactive-brand-strong' ],
818
'primary-fgFill': [
919
'foreground-interactive-brand-strong',

packages/theme/tokens/color.json

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
"wpds-color": {
33
"$type": "color",
44
"primitive": {
5+
"transparent": {
6+
"$value": {
7+
"colorSpace": "srgb",
8+
"components": [ 0, 0, 0 ],
9+
"alpha": 0
10+
}
11+
},
512
"primary": {
613
"bgFill1": {
714
"$value": {
@@ -1168,23 +1175,15 @@
11681175
"$description": "Background color for interactive elements with neutral tone and strong emphasis, in their disabled state."
11691176
},
11701177
"neutral-weak": {
1171-
"$value": {
1172-
"colorSpace": "srgb",
1173-
"components": [ 0, 0, 0 ],
1174-
"alpha": 0
1175-
},
1178+
"$value": "{wpds-color.primitive.transparent}",
11761179
"$description": "Background color for interactive elements with neutral tone and weak emphasis."
11771180
},
11781181
"neutral-weak-active": {
11791182
"$value": "{wpds-color.primitive.bg.surface4}",
11801183
"$description": "Background color for interactive elements with neutral tone and weak emphasis that are hovered, focused, or active."
11811184
},
11821185
"neutral-weak-disabled": {
1183-
"$value": {
1184-
"colorSpace": "srgb",
1185-
"components": [ 0, 0, 0 ],
1186-
"alpha": 0
1187-
},
1186+
"$value": "{wpds-color.primitive.transparent}",
11881187
"$description": "Background color for interactive elements with neutral tone and weak emphasis, in their disabled state."
11891188
},
11901189
"brand-strong": {
@@ -1200,43 +1199,27 @@
12001199
"$description": "Background color for interactive elements with brand tone and strong emphasis, in their disabled state."
12011200
},
12021201
"brand-weak": {
1203-
"$value": {
1204-
"colorSpace": "srgb",
1205-
"components": [ 0, 0, 0 ],
1206-
"alpha": 0
1207-
},
1202+
"$value": "{wpds-color.primitive.transparent}",
12081203
"$description": "Background color for interactive elements with brand tone and weak emphasis."
12091204
},
12101205
"brand-weak-active": {
12111206
"$value": "{wpds-color.primitive.primary.surface4}",
12121207
"$description": "Background color for interactive elements with brand tone and weak emphasis that are hovered, focused, or active."
12131208
},
12141209
"brand-weak-disabled": {
1215-
"$value": {
1216-
"colorSpace": "srgb",
1217-
"components": [ 0, 0, 0 ],
1218-
"alpha": 0
1219-
},
1210+
"$value": "{wpds-color.primitive.transparent}",
12201211
"$description": "Background color for interactive elements with brand tone and weak emphasis, in their disabled state."
12211212
},
12221213
"error": {
1223-
"$value": {
1224-
"colorSpace": "srgb",
1225-
"components": [ 0, 0, 0 ],
1226-
"alpha": 0
1227-
},
1214+
"$value": "{wpds-color.primitive.transparent}",
12281215
"$description": "Background color for interactive elements with error tone and normal emphasis."
12291216
},
12301217
"error-active": {
12311218
"$value": "{wpds-color.primitive.error.surface2}",
12321219
"$description": "Background color for interactive elements with error tone and normal emphasis that are hovered, focused, or active."
12331220
},
12341221
"error-disabled": {
1235-
"$value": {
1236-
"colorSpace": "srgb",
1237-
"components": [ 0, 0, 0 ],
1238-
"alpha": 0
1239-
},
1222+
"$value": "{wpds-color.primitive.transparent}",
12401223
"$description": "Background color for interactive elements with error tone and normal emphasis, in their disabled state."
12411224
},
12421225
"error-strong": {
@@ -1252,23 +1235,15 @@
12521235
"$description": "Background color for interactive elements with error tone and strong emphasis, in their disabled state."
12531236
},
12541237
"error-weak": {
1255-
"$value": {
1256-
"colorSpace": "srgb",
1257-
"components": [ 0, 0, 0 ],
1258-
"alpha": 0
1259-
},
1238+
"$value": "{wpds-color.primitive.transparent}",
12601239
"$description": "Background color for interactive elements with error tone and weak emphasis."
12611240
},
12621241
"error-weak-active": {
12631242
"$value": "{wpds-color.primitive.error.surface4}",
12641243
"$description": "Background color for interactive elements with error tone and weak emphasis that are hovered, focused, or active."
12651244
},
12661245
"error-weak-disabled": {
1267-
"$value": {
1268-
"colorSpace": "srgb",
1269-
"components": [ 0, 0, 0 ],
1270-
"alpha": 0
1271-
},
1246+
"$value": "{wpds-color.primitive.transparent}",
12721247
"$description": "Background color for interactive elements with error tone and weak emphasis, in their disabled state."
12731248
}
12741249
},

0 commit comments

Comments
 (0)