Skip to content

Commit 00ad9f1

Browse files
dont export new high contrast modes (#1245)
1 parent 2c902cc commit 00ad9f1

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

scripts/buildFigma.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import fs from 'fs'
22
import {PrimerStyleDictionary} from '../src/primerStyleDictionary.js'
3-
import {themes} from './themes.config.js'
3+
import {themes as origialThemes} from './themes.config.js'
44
import {figma} from '../src/platforms/index.js'
55
import type {ConfigGeneratorOptions} from '../src/types/styleDictionaryConfigGenerator.js'
66
import {getFallbackTheme} from './utilities/getFallbackTheme.js'
77

88
const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> => {
9+
const themes = origialThemes.filter(theme => theme.exportToFigma !== false)
910
/** -----------------------------------
1011
* Colors
1112
* ----------------------------------- */

scripts/themes.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const themes: TokenBuildInput[] = [
44
{
55
filename: 'light',
66
theme: 'light',
7+
exportToFigma: true,
78
source: [
89
`src/tokens/functional/shadow/shadow.json5`,
910
`src/tokens/functional/border/*.json5`,
@@ -19,6 +20,7 @@ export const themes: TokenBuildInput[] = [
1920
{
2021
filename: 'light-tritanopia',
2122
theme: 'light-tritanopia',
23+
exportToFigma: true,
2224
source: [
2325
`src/tokens/functional/shadow/shadow.json5`,
2426
`src/tokens/functional/border/*.json5`,
@@ -34,6 +36,7 @@ export const themes: TokenBuildInput[] = [
3436
{
3537
filename: 'light-tritanopia-high-contrast',
3638
theme: 'light-tritanopia-high-contrast',
39+
exportToFigma: false,
3740
source: [
3841
`src/tokens/functional/shadow/shadow.json5`,
3942
`src/tokens/functional/border/*.json5`,
@@ -51,6 +54,7 @@ export const themes: TokenBuildInput[] = [
5154
{
5255
filename: 'light-colorblind',
5356
theme: 'light-protanopia-deuteranopia',
57+
exportToFigma: true,
5458
source: [
5559
`src/tokens/functional/shadow/shadow.json5`,
5660
`src/tokens/functional/border/*.json5`,
@@ -66,6 +70,7 @@ export const themes: TokenBuildInput[] = [
6670
{
6771
filename: 'light-colorblind-high-contrast',
6872
theme: 'light-protanopia-deuteranopia-high-contrast',
73+
exportToFigma: false,
6974
source: [
7075
`src/tokens/functional/shadow/shadow.json5`,
7176
`src/tokens/functional/border/*.json5`,
@@ -83,6 +88,7 @@ export const themes: TokenBuildInput[] = [
8388
{
8489
filename: 'light-high-contrast',
8590
theme: 'light-high-contrast',
91+
exportToFigma: true,
8692
source: [
8793
`src/tokens/functional/shadow/shadow.json5`,
8894
`src/tokens/functional/border/*.json5`,
@@ -99,6 +105,7 @@ export const themes: TokenBuildInput[] = [
99105
{
100106
filename: 'dark',
101107
theme: 'dark',
108+
exportToFigma: true,
102109
source: [
103110
`src/tokens/functional/shadow/shadow.json5`,
104111
`src/tokens/functional/border/*.json5`,
@@ -114,6 +121,7 @@ export const themes: TokenBuildInput[] = [
114121
{
115122
filename: 'dark-dimmed',
116123
theme: 'dark-dimmed',
124+
exportToFigma: true,
117125
source: [
118126
`src/tokens/functional/shadow/shadow.json5`,
119127
`src/tokens/functional/border/*.json5`,
@@ -130,6 +138,7 @@ export const themes: TokenBuildInput[] = [
130138
{
131139
filename: 'dark-dimmed-high-contrast',
132140
theme: 'dark-dimmed-high-contrast',
141+
exportToFigma: false,
133142
source: [
134143
`src/tokens/functional/shadow/shadow.json5`,
135144
`src/tokens/functional/border/*.json5`,
@@ -148,6 +157,7 @@ export const themes: TokenBuildInput[] = [
148157
{
149158
filename: 'dark-tritanopia',
150159
theme: 'dark-tritanopia',
160+
exportToFigma: true,
151161
source: [
152162
`src/tokens/functional/shadow/shadow.json5`,
153163
`src/tokens/functional/border/*.json5`,
@@ -163,6 +173,7 @@ export const themes: TokenBuildInput[] = [
163173
{
164174
filename: 'dark-tritanopia-high-contrast',
165175
theme: 'dark-tritanopia-high-contrast',
176+
exportToFigma: false,
166177
source: [
167178
`src/tokens/functional/shadow/shadow.json5`,
168179
`src/tokens/functional/border/*.json5`,
@@ -180,6 +191,7 @@ export const themes: TokenBuildInput[] = [
180191
{
181192
filename: 'dark-colorblind',
182193
theme: 'dark-protanopia-deuteranopia',
194+
exportToFigma: true,
183195
source: [
184196
`src/tokens/functional/shadow/shadow.json5`,
185197
`src/tokens/functional/border/*.json5`,
@@ -195,6 +207,7 @@ export const themes: TokenBuildInput[] = [
195207
{
196208
filename: 'dark-colorblind-high-contrast',
197209
theme: 'dark-protanopia-deuteranopia-high-contrast',
210+
exportToFigma: false,
198211
source: [
199212
`src/tokens/functional/shadow/shadow.json5`,
200213
`src/tokens/functional/border/*.json5`,
@@ -212,6 +225,7 @@ export const themes: TokenBuildInput[] = [
212225
{
213226
filename: 'dark-high-contrast',
214227
theme: 'dark-high-contrast',
228+
exportToFigma: true,
215229
source: [
216230
`src/tokens/functional/shadow/shadow.json5`,
217231
`src/tokens/functional/border/*.json5`,

src/types/tokenBuildInput.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
export type TokenBuildInput = {
22
// The output filename WITHOUT the extension
33
filename: string
4+
// defines if the theme should be exported to Figma
5+
exportToFigma: boolean
46
// Array of `filepaths` to token files that should be converted and included in the output. Accepts relative or glob paths.
57
source: string[]
68
// The mode of the theme

0 commit comments

Comments
 (0)