@@ -14,10 +14,22 @@ export const buildFigma = (buildOptions: ConfigGeneratorOptions): void => {
14
14
name : 'light' ,
15
15
source : [ `src/tokens/base/color/light/light.json5` ] ,
16
16
} ,
17
+ {
18
+ name : 'light-high-constrast' ,
19
+ source : [ `src/tokens/base/color/light/light.json5` , `src/tokens/base/color/light/light.high-contrast.json5` ] ,
20
+ } ,
17
21
{
18
22
name : 'dark' ,
19
23
source : [ `src/tokens/base/color/dark/dark.json5` ] ,
20
24
} ,
25
+ {
26
+ name : 'dark-high-constrast' ,
27
+ source : [ `src/tokens/base/color/dark/dark.json5` , `src/tokens/base/color/dark/dark.high-contrast.json5` ] ,
28
+ } ,
29
+ {
30
+ name : 'dark-dimmed' ,
31
+ source : [ `src/tokens/base/color/dark/dark.json5` , `src/tokens/base/color/dark/dark.dimmed.json5` ] ,
32
+ } ,
21
33
]
22
34
23
35
for ( const { name, source} of baseScales ) {
@@ -30,18 +42,16 @@ export const buildFigma = (buildOptions: ConfigGeneratorOptions): void => {
30
42
}
31
43
//
32
44
for ( const { filename, source, include} of themes ) {
33
- if ( [ 'light' , 'dark' ] . includes ( filename ) ) {
34
- // build functional scales
35
- PrimerStyleDictionary . extend ( {
36
- source,
37
- include,
38
- platforms : {
39
- figma : figma ( `figma/themes/${ filename } .json` , buildOptions . prefix , buildOptions . buildPath , {
40
- mode : filename ,
41
- } ) ,
42
- } ,
43
- } ) . buildAllPlatforms ( )
44
- }
45
+ // build functional scales
46
+ PrimerStyleDictionary . extend ( {
47
+ source,
48
+ include,
49
+ platforms : {
50
+ figma : figma ( `figma/themes/${ filename } .json` , buildOptions . prefix , buildOptions . buildPath , {
51
+ mode : filename . replaceAll ( '-' , ' ' ) ,
52
+ } ) ,
53
+ } ,
54
+ } ) . buildAllPlatforms ( )
45
55
}
46
56
/** -----------------------------------
47
57
* Size tokens
@@ -109,7 +119,17 @@ export const buildFigma = (buildOptions: ConfigGeneratorOptions): void => {
109
119
110
120
// define the order of the modes
111
121
// we inverse it to deal with the -1 of the indexOf if item is not found in the array: basically anything that is not in the list should come last
112
- const modeOrder = [ 'light' , 'dark' ] . reverse ( )
122
+ const modeOrder = [
123
+ 'light' ,
124
+ 'dark' ,
125
+ 'dark dimmed' ,
126
+ 'light high contrast' ,
127
+ 'dark high contrast' ,
128
+ 'light colorblind' ,
129
+ 'dark colorblind' ,
130
+ 'light tritanopia' ,
131
+ 'dark tritanopia' ,
132
+ ] . reverse ( )
113
133
// sort modes in the order defined above
114
134
for ( const collection in collections ) {
115
135
collections [ collection ] . modes . sort ( ( a , b ) => modeOrder . indexOf ( b ) - modeOrder . indexOf ( a ) )
0 commit comments