@@ -129,6 +129,12 @@ The parameters for the default export options are exported as type `ColorRadixPr
129
129
- Whether the ` base ` value should use the Radix dark or light color mode.
130
130
- Options: ` "light" | "dark" `
131
131
- Default: ` colorModeConditions.default ` ?? ` "dark" `
132
+ - ` contrastColorOverrides ` (` ContrastColorOverrides ` , _ Optional_ )
133
+ - If overrides are included, all the properties below should be included.
134
+ - ` black ` (` string ` )
135
+ - The color or color token to replace the default value of ` black ` for 0, 9c, and 13 scale values. It should have adequate contrast for accessibility with scale values 9-12 as a background color for colors amber, yellow, mint, lime, and sky.
136
+ - ` white ` (` string ` )
137
+ - The color or color token to replace the default value of ` white ` for 0, 9c, and 13 scale values. It should have adequate contrast for accessibility with scale values 9-12 as a background color for colors other than amber, yellow, mint, lime, and sky.
132
138
133
139
#### Return
134
140
@@ -157,6 +163,7 @@ const coreTokenStructure = {
157
163
colors: {
158
164
radix: {
159
165
gray: {
166
+ " 0" : { DEFAULT: { value: " #000000" }, light: { value: " #ffffff" }, dark: { value: " #000000" } },
160
167
" 1" : { DEFAULT: { value: " #111111" }, light: { value: " #fcfcfc" }, dark: { value: " #111111" } },
161
168
" 2" : { DEFAULT: { value: " #191919" }, light: { value: " #f9f9f9" }, dark: { value: " #191919" } },
162
169
" 3" : { DEFAULT: { value: " #222222" }, light: { value: " #f0f0f0" }, dark: { value: " #222222" } },
@@ -166,12 +173,15 @@ const coreTokenStructure = {
166
173
" 7" : { DEFAULT: { value: " #484848" }, light: { value: " #cecece" }, dark: { value: " #484848" } },
167
174
" 8" : { DEFAULT: { value: " #606060" }, light: { value: " #bbbbbb" }, dark: { value: " #606060" } },
168
175
" 9" : { DEFAULT: { value: " #6e6e6e" }, light: { value: " #8d8d8d" }, dark: { value: " #6e6e6e" } },
176
+ " 9c" : { DEFAULT: { value: " #ffffff" }, light: {value: " #ffffff" }, dark: { value : " #ffffff" } },
169
177
" 10" : { DEFAULT: { value: " #7b7b7b" }, light: { value: " #838383" }, dark: { value: " #7b7b7b" } },
170
178
" 11" : { DEFAULT: { value: " #b4b4b4" }, light: { value: " #646464" }, dark: { value: " #b4b4b4" } },
171
- " 12" : { DEFAULT: { value: " #eeeeee" }, light: { value: " #202020" }, dark: { value: " #eeeeee" } }
179
+ " 12" : { DEFAULT: { value: " #eeeeee" }, light: { value: " #202020" }, dark: { value: " #eeeeee" } },
180
+ " 13" : { DEFAULT: { value: " #ffffff" }, light: { value: " #000000" }, dark: { value: " #ffffff" } },
172
181
},
173
182
// ... Other Colors
174
183
orange: {
184
+ " 0" : { DEFAULT: { value: " #000000" }, light: { value: " #ffffff" }, dark: { value: " #000000" } },
175
185
" 1" : { DEFAULT: { value: " #17120e" }, light: { value: " #fefcfb" }, dark: { value: " #17120e" } },
176
186
" 2" : { DEFAULT: { value: " #1e160f" }, light: { value: " #fff7ed" }, dark: { value: " #1e160f" } },
177
187
" 3" : { DEFAULT: { value: " #331e0b" }, light: { value: " #ffefd6" }, dark: { value: " #331e0b" } },
@@ -181,9 +191,11 @@ const coreTokenStructure = {
181
191
" 7" : { DEFAULT: { value: " #7e451d" }, light: { value: " #f5ae73" }, dark: { value: " #7e451d" } },
182
192
" 8" : { DEFAULT: { value: " #a35829" }, light: { value: " #ec9455" }, dark: { value: " #a35829" } },
183
193
" 9" : { DEFAULT: { value: " #f76b15" }, light: { value: " #f76b15" }, dark: { value: " #f76b15" } },
194
+ " 9c" : { DEFAULT: { value: " #ffffff" }, light: {value: " #ffffff" }, dark: { value : " #ffffff" } },
184
195
" 10" : { DEFAULT: { value: " #ff801f" }, light: { value: " #ef5f00" }, dark: { value: " #ff801f" } },
185
196
" 11" : { DEFAULT: { value: " #ffa057" }, light: { value: " #cc4e00" }, dark: { value: " #ffa057" } },
186
- " 12" : { DEFAULT: { value: " #ffe0c2" }, light: { value: " #582d1d" }, dark: { value: " #ffe0c2" } }
197
+ " 12" : { DEFAULT: { value: " #ffe0c2" }, light: { value: " #582d1d" }, dark: { value: " #ffe0c2" } },
198
+ " 13" : { DEFAULT: { value: " #ffffff" }, light: { value: " #000000" }, dark: { value: " #ffffff" } },
187
199
}
188
200
}
189
201
}
@@ -215,9 +227,9 @@ const semanticTokenStructure = {
215
227
colors: {
216
228
radix: {
217
229
grass: {
218
- " 1 " : { " DEFAULT" : { value: " #0e1511 " }, light: { value: " #fbfefb " }, dark: { value: " #0e1511 " } },
230
+ " 0 " : { DEFAULT: { value: " #000000 " }, light: { value: " #ffffff " }, dark: { value: " #000000 " } },
219
231
// ... Other color scale values
220
- " 12 " : { " DEFAULT" : { value: " #c2f0c2 " }, light: { value: " #203c25 " }, dark: { value: " #c2f0c2 " } }
232
+ " 13 " : { DEFAULT: { value: " #ffffff " }, light: { value: " #000000 " }, dark: { value: " #ffffff " } },
221
233
}
222
234
}
223
235
}
@@ -226,19 +238,19 @@ const semanticTokenStructure = {
226
238
colors: {
227
239
radix: {
228
240
primary: {
229
- " 1 " : {
241
+ " 0 " : {
230
242
value: {
231
- base: " {colors.radix.grass.1 .dark}" ,
232
- _light: " {colors.radix.grass.1 .light}" ,
233
- _dark: " {colors.radix.grass.1 .dark}"
243
+ base: " {colors.radix.grass.0 .dark}" ,
244
+ _light: " {colors.radix.grass.0 .light}" ,
245
+ _dark: " {colors.radix.grass.0 .dark}"
234
246
}
235
247
},
236
248
// ... Other color scale values
237
- " 12 " : {
249
+ " 13 " : {
238
250
value: {
239
- base: " {colors.radix.grass.12 .dark}" ,
240
- _light: " {colors.radix.grass.12 .light}" ,
241
- _dark: " {colors.radix.grass.12 .dark}"
251
+ base: " {colors.radix.grass.13 .dark}" ,
252
+ _light: " {colors.radix.grass.13 .light}" ,
253
+ _dark: " {colors.radix.grass.13 .dark}"
242
254
}
243
255
}
244
256
}
@@ -293,72 +305,6 @@ export default defineConfig({
293
305
});
294
306
```
295
307
296
- ``` typescript
297
- const allColors = {
298
- theme: {
299
- extend: {
300
- tokens: {
301
- colors: {
302
- radix: {
303
- gray: {
304
- 1 : {
305
- DEFAULT: {
306
- value: " #111111"
307
- },
308
- light: {
309
- value: " #fcfcfc"
310
- },
311
- dark: {
312
- value: " #111111"
313
- }
314
- },
315
- // ... Rest of color scale
316
- 12 : {
317
- DEFAULT: {
318
- value: " #eeeeee"
319
- },
320
- light: {
321
- value: " #202020"
322
- },
323
- dark: {
324
- value: " #eeeeee"
325
- }
326
- }
327
- },
328
- // ... Other Colors
329
- orange: {
330
- 1 : {
331
- DEFAULT: {
332
- value: " #17120e"
333
- },
334
- light: {
335
- value: " #fefcfb"
336
- },
337
- dark: {
338
- value: " #17120e"
339
- }
340
- },
341
- // ... Rest of color scale
342
- 12 : {
343
- DEFAULT: {
344
- value: " #ffe0c2"
345
- },
346
- light: {
347
- value: " #582d1d"
348
- },
349
- dark: {
350
- value: " #ffe0c2"
351
- }
352
- }
353
- }
354
- }
355
- }
356
- }
357
- }
358
- }
359
- }
360
- ```
361
-
362
308
[ > Back to examples] ( #examples )
363
309
364
310
### Generate some colors as core tokens
@@ -379,46 +325,6 @@ export default defineConfig({
379
325
380
326
This generates only the color tokens that are included in the colors array.
381
327
382
- ``` typescript
383
- const someColors = {
384
- theme: {
385
- extend: {
386
- tokens: {
387
- colors: {
388
- radix: {
389
- cyan: {
390
- 1 : {
391
- DEFAULT: {
392
- value: " #0b161a"
393
- },
394
- light: {
395
- value: " #fafdfe"
396
- },
397
- dark: {
398
- value: " #0b161a"
399
- }
400
- },
401
- // ... Rest of color scale
402
- 12 : {
403
- DEFAULT: {
404
- value: " #b6ecf7"
405
- },
406
- light: {
407
- value: " #0d3c48"
408
- },
409
- dark: {
410
- value: " #b6ecf7"
411
- }
412
- }
413
- }
414
- }
415
- }
416
- }
417
- }
418
- }
419
- }
420
- ```
421
-
422
328
[ > Back to examples] ( #examples )
423
329
424
330
### Change the default color mode to light for core tokens
@@ -446,7 +352,7 @@ const defaultLightCoreStructure = {
446
352
radix: {
447
353
// ... Other colors
448
354
grass: {
449
- ' 1 ' : {
355
+ ' 0 ' : {
450
356
DEFAULT: { value: ' lightValue' },
451
357
light: { value: ' lightValue' },
452
358
dark: { value: ' darkValue' }
@@ -531,11 +437,11 @@ const defaultSemanticStructure = {
531
437
colors: {
532
438
radix: {
533
439
primary: {
534
- 1 : {
440
+ 0 : {
535
441
value: {
536
- base: ' {colors.grass.1 .dark}' ,
537
- _light: ' {colors.grass.1 .light}' ,
538
- _dark: ' {colors.grass.1 .dark}' ,
442
+ base: ' {colors.grass.0 .dark}' ,
443
+ _light: ' {colors.grass.0 .light}' ,
444
+ _dark: ' {colors.grass.0 .dark}' ,
539
445
},
540
446
},
541
447
// ... Rest of color scale
@@ -583,11 +489,11 @@ const customLightSemanticStructure = {
583
489
colors: {
584
490
radix: {
585
491
primary: {
586
- 1 : {
492
+ 0 : {
587
493
value: {
588
- base: ' {colors.grass.1 .dark}' ,
589
- _light: ' {colors.grass.1 .light}' ,
590
- _osLight: ' {colors.grass.1 .light}' ,
494
+ base: ' {colors.grass.0 .dark}' ,
495
+ _light: ' {colors.grass.0 .light}' ,
496
+ _osLight: ' {colors.grass.0 .light}' ,
591
497
},
592
498
},
593
499
// ... Rest of color scale
@@ -635,11 +541,11 @@ const customDarkSemanticStructure = {
635
541
colors: {
636
542
radix: {
637
543
primary: {
638
- 1 : {
544
+ 0 : {
639
545
value: {
640
- base: ' {colors.grass.1 .dark}' ,
641
- _dark: ' {colors.grass.1 .dark}' ,
642
- _osDark: ' {colors.grass.1 .dark}' ,
546
+ base: ' {colors.grass.0 .dark}' ,
547
+ _dark: ' {colors.grass.0 .dark}' ,
548
+ _osDark: ' {colors.grass.0 .dark}' ,
643
549
},
644
550
},
645
551
// ... Rest of color scale
0 commit comments