Skip to content

Commit 5516d98

Browse files
Remove usage of mix (#1115)
* removing mix * f * updates * f * f
1 parent faa6588 commit 5516d98

34 files changed

+314
-631
lines changed

README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -80,27 +80,6 @@ You can create color tokens that inherit a color but have a different alpha valu
8080
}
8181
```
8282

83-
#### Mix
84-
85-
In rare cases, you may need to create a color between two steps in the color scale, e.g. between `gray.4` and `gray.5`. A common example are interactive states, like `hover` where a full step on the color scale would be to much. For those cases you can use the `mix` property.
86-
87-
The `mix` proeprty mixes the color it gets into the main color from the `$value` attribute. The amount added is controlled by the `weight`. A weight of `0.1` adds 10% of the color, and a weight of `0.75` adds 75%.
88-
89-
A `mix` proprty must always have a `color` and a `weight` child. `color` can be a `hex` value or a reference to a valid color. The `weight` property must receive a value between `0.0` and `1`.
90-
91-
```json5
92-
{
93-
control: {
94-
$value: '{base.color.gray.4}', // main color
95-
$type: 'color',
96-
mix: {
97-
color: '{base.color.gray.5}', // color to mix into the main color
98-
weight: 0.2, // amount of the mix color that is added === 20% of gray.5 is mix into gray.4
99-
},
100-
},
101-
}
102-
```
103-
10483
#### Extensions property
10584

10685
According to the [w3c design token specs](https://design-tokens.github.io/community-group/format/#design-token), the [`$extensions`](https://design-tokens.github.io/community-group/format/#extensions) property is used for additional meta data.

integration/integration.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ describe('PrimerStyleDictionary', async () => {
1515
transforms: [
1616
'name/pathToKebabCase',
1717
'color/hex',
18-
'color/hexMix',
1918
'dimension/rem',
2019
'duration/css',
2120
'shadow/css',
@@ -40,7 +39,6 @@ describe('PrimerStyleDictionary', async () => {
4039
usesDtcg: true,
4140
transforms: [
4241
'color/hex',
43-
'color/hexMix',
4442
'dimension/rem',
4543
'shadow/css',
4644
'border/css',
@@ -65,7 +63,6 @@ describe('PrimerStyleDictionary', async () => {
6563
buildPath: `${buildPath}/js/`,
6664
transforms: [
6765
'color/hex',
68-
'color/hexMix',
6966
'dimension/rem',
7067
'shadow/css',
7168
'border/css',
@@ -112,7 +109,6 @@ describe('PrimerStyleDictionary', async () => {
112109
buildPath: `${buildPath}/json/`,
113110
transforms: [
114111
'color/hex',
115-
'color/hexMix',
116112
'dimension/rem',
117113
'shadow/css',
118114
'border/css',

scripts/diffTokenProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ type DiffItem = {
1111

1212
const isToken = (obj: Record<string, unknown>): boolean => Object.prototype.hasOwnProperty.call(obj, '$value')
1313

14-
const diffProps = (diffArray: DiffItem[], propsToCheck = ['mix', 'alpha']) => {
14+
const diffProps = (diffArray: DiffItem[], propsToCheck = ['alpha']) => {
1515
const diff = []
1616
// iterate over each theme
1717
for (const {mainThemeName, mainThemeDir, mainFiles, overridesDir} of diffArray) {

src/filters/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
export {isBorder} from './isBorder.js'
22
export {isColor} from './isColor.js'
33
export {isColorWithAlpha} from './isColorWithAlpha.js'
4-
export {isColorWithMix} from './isColorWithMix.js'
54
export {isDimension} from './isDimension.js'
65
export {isDeprecated} from './isDeprecated.js'
76
export {isDuration} from './isDuration.js'

src/filters/isColorWithMix.test.ts

Lines changed: 0 additions & 108 deletions
This file was deleted.

src/filters/isColorWithMix.ts

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/formats/jsonFigma.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const jsonFigma: FormatFn = async ({dictionary, file: _file, platform}: F
8282
// loop through tokens sorted by reference
8383
for (const token of sortedTokens) {
8484
// deconstruct token
85-
const {attributes, $value: value, $type, $description: description, original, alpha, mix} = token
85+
const {attributes, $value: value, $type, $description: description, original, alpha} = token
8686
const {mode, collection, scopes, group, codeSyntax} = attributes || {}
8787
// early escape if no type is present
8888
if (!$type) return
@@ -115,7 +115,6 @@ export const jsonFigma: FormatFn = async ({dictionary, file: _file, platform}: F
115115
value,
116116
type: getFigmaType($type),
117117
alpha,
118-
isMix: mix ? true : undefined,
119118
description,
120119
refId: [collection, token.name].filter(Boolean).join('/'),
121120
reference: getReference(dictionary, original.$value, platform),

src/platforms/css.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export const css: PlatformInitializer = (outputFile, prefix, buildPath, options)
2828
transforms: [
2929
'name/pathToKebabCase',
3030
'color/hex',
31-
'color/hexMix',
3231
'cubicBezier/css',
3332
'dimension/rem',
3433
'duration/css',

src/platforms/docJson.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const docJson: PlatformInitializer = (outputFile, prefix, buildPath, opti
99
transforms: [
1010
'name/pathToKebabCase',
1111
'color/hex',
12-
'color/hexMix',
1312
'dimension/rem',
1413
'shadow/css',
1514
'border/css',

src/platforms/fallbacks.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const fallbacks: PlatformInitializer = (outputFile, prefix, buildPath): P
88
transforms: [
99
'name/pathToKebabCase',
1010
'color/hex',
11-
'color/hexMix',
1211
'dimension/rem',
1312
'shadow/css',
1413
'border/css',

src/platforms/javascript.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const javascript: PlatformInitializer = (outputFile, prefix, buildPath, o
88
preprocessors: ['themeOverrides'],
99
transforms: [
1010
'color/hex',
11-
'color/hexMix',
1211
'dimension/rem',
1312
'shadow/css',
1413
'border/css',

src/platforms/json.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const json: PlatformInitializer = (outputFile, prefix, buildPath, options
88
preprocessors: ['themeOverrides'],
99
transforms: [
1010
'color/hex',
11-
'color/hexMix',
1211
'dimension/rem',
1312
'shadow/css',
1413
'border/css',

src/platforms/styleLint.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const styleLint: PlatformInitializer = (outputFile, prefix, buildPath, op
99
transforms: [
1010
'name/pathToKebabCase',
1111
'color/hex',
12-
'color/hexMix',
1312
'dimension/remPxArray',
1413
'shadow/css',
1514
'border/css',

src/platforms/typescript.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export const typescript: PlatformInitializer = (outputFile, prefix, buildPath, o
88
preprocessors: ['themeOverrides'],
99
transforms: [
1010
'color/hex',
11-
'color/hexMix',
1211
'dimension/rem',
1312
'shadow/css',
1413
'border/css',

src/primerStyleDictionary.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
borderToCss,
44
colorToRgbAlpha,
55
colorToHex,
6-
colorToHexMix,
76
colorToRgbaFloat,
87
cubicBezierToCss,
98
dimensionToRem,
@@ -109,8 +108,6 @@ PrimerStyleDictionary.registerTransform(colorToRgbAlpha)
109108

110109
PrimerStyleDictionary.registerTransform(colorToRgbaFloat)
111110

112-
PrimerStyleDictionary.registerTransform(colorToHexMix)
113-
114111
PrimerStyleDictionary.registerTransform(colorToHex)
115112

116113
PrimerStyleDictionary.registerTransform(cubicBezierToCss)

src/schemas/colorToken.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ export const colorToken = baseToken
1212
$value: z.union([colorHexValue, referenceValue]),
1313
$type: tokenType('color'),
1414
alpha: alphaValue.optional().nullable(),
15-
mix: z
16-
.object({
17-
color: z.string(),
18-
weight: z.number().min(0).max(1),
19-
})
20-
.nullable()
21-
.optional(),
2215
$extensions: z
2316
.object({
2417
alpha: z.number().min(0).max(1).optional().nullable(),

src/tokens/functional/color/dark/app-dark.json5

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
},
7373
},
7474
alpha: 0.15,
75-
mix: null,
7675
},
7776
},
7877
additionWord: {
@@ -153,7 +152,6 @@
153152
scopes: ['bgColor'],
154153
},
155154
},
156-
mix: null,
157155
},
158156
},
159157
deletionWord: {

0 commit comments

Comments
 (0)