@wordpress/theme 0.1.0 → 0.1.1-next.2f1c7c01b.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +69 -9
  2. package/bin/generate-default-ramps/index.ts +49 -0
  3. package/bin/generate-primitive-tokens/index.ts +14 -9
  4. package/bin/terrazzo-plugin-figma-ds-token-manager/index.ts +11 -4
  5. package/build/color-ramps/index.js +21 -39
  6. package/build/color-ramps/index.js.map +3 -3
  7. package/build/color-ramps/lib/color-utils.js +39 -0
  8. package/build/color-ramps/lib/color-utils.js.map +7 -0
  9. package/build/color-ramps/lib/constants.js +18 -25
  10. package/build/color-ramps/lib/constants.js.map +3 -3
  11. package/build/color-ramps/lib/default-ramps.js +220 -0
  12. package/build/color-ramps/lib/default-ramps.js.map +7 -0
  13. package/build/color-ramps/lib/find-color-with-constraints.js +57 -71
  14. package/build/color-ramps/lib/find-color-with-constraints.js.map +3 -3
  15. package/build/color-ramps/lib/index.js +25 -68
  16. package/build/color-ramps/lib/index.js.map +3 -3
  17. package/build/color-ramps/lib/ramp-configs.js +12 -11
  18. package/build/color-ramps/lib/ramp-configs.js.map +1 -1
  19. package/build/color-ramps/lib/register-color-spaces.js +7 -0
  20. package/build/color-ramps/lib/register-color-spaces.js.map +7 -0
  21. package/build/color-ramps/lib/taper-chroma.js +35 -27
  22. package/build/color-ramps/lib/taper-chroma.js.map +3 -3
  23. package/build/color-ramps/lib/types.js +2 -1
  24. package/build/color-ramps/lib/types.js.map +1 -1
  25. package/build/color-ramps/lib/utils.js +12 -9
  26. package/build/color-ramps/lib/utils.js.map +2 -2
  27. package/build/context.js +3 -2
  28. package/build/context.js.map +1 -1
  29. package/build/index.js +2 -1
  30. package/build/index.js.map +1 -1
  31. package/build/lock-unlock.js +3 -2
  32. package/build/lock-unlock.js.map +1 -1
  33. package/build/prebuilt/js/design-tokens.js +14 -1
  34. package/build/prebuilt/js/design-tokens.js.map +2 -2
  35. package/build/prebuilt/json/figma.json +214 -32
  36. package/build/prebuilt/ts/design-tokens.js +38 -1
  37. package/build/prebuilt/ts/design-tokens.js.map +2 -2
  38. package/build/private-apis.js +3 -2
  39. package/build/private-apis.js.map +1 -1
  40. package/build/theme-provider.js +19 -17
  41. package/build/theme-provider.js.map +4 -4
  42. package/build/types/css-modules.d.js +0 -1
  43. package/build/types.js +2 -1
  44. package/build/types.js.map +1 -1
  45. package/build/use-theme-provider-styles.js +50 -36
  46. package/build/use-theme-provider-styles.js.map +3 -3
  47. package/build-module/color-ramps/index.js +20 -28
  48. package/build-module/color-ramps/index.js.map +2 -2
  49. package/build-module/color-ramps/lib/color-utils.js +19 -0
  50. package/build-module/color-ramps/lib/color-utils.js.map +7 -0
  51. package/build-module/color-ramps/lib/constants.js +13 -10
  52. package/build-module/color-ramps/lib/constants.js.map +2 -2
  53. package/build-module/color-ramps/lib/default-ramps.js +196 -0
  54. package/build-module/color-ramps/lib/default-ramps.js.map +7 -0
  55. package/build-module/color-ramps/lib/find-color-with-constraints.js +56 -60
  56. package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
  57. package/build-module/color-ramps/lib/index.js +28 -55
  58. package/build-module/color-ramps/lib/index.js.map +3 -3
  59. package/build-module/color-ramps/lib/ramp-configs.js +11 -10
  60. package/build-module/color-ramps/lib/ramp-configs.js.map +1 -1
  61. package/build-module/color-ramps/lib/register-color-spaces.js +7 -0
  62. package/build-module/color-ramps/lib/register-color-spaces.js.map +7 -0
  63. package/build-module/color-ramps/lib/taper-chroma.js +40 -16
  64. package/build-module/color-ramps/lib/taper-chroma.js.map +2 -2
  65. package/build-module/color-ramps/lib/utils.js +7 -4
  66. package/build-module/color-ramps/lib/utils.js.map +2 -2
  67. package/build-module/context.js +2 -1
  68. package/build-module/context.js.map +1 -1
  69. package/build-module/index.js +1 -0
  70. package/build-module/index.js.map +1 -1
  71. package/build-module/lock-unlock.js +2 -1
  72. package/build-module/lock-unlock.js.map +1 -1
  73. package/build-module/prebuilt/js/design-tokens.js +13 -0
  74. package/build-module/prebuilt/js/design-tokens.js.map +2 -2
  75. package/build-module/prebuilt/json/figma.json +214 -32
  76. package/build-module/prebuilt/ts/design-tokens.js +37 -0
  77. package/build-module/prebuilt/ts/design-tokens.js.map +2 -2
  78. package/build-module/private-apis.js +2 -1
  79. package/build-module/private-apis.js.map +1 -1
  80. package/build-module/theme-provider.js +18 -6
  81. package/build-module/theme-provider.js.map +3 -3
  82. package/build-module/use-theme-provider-styles.js +52 -31
  83. package/build-module/use-theme-provider-styles.js.map +2 -2
  84. package/build-types/color-ramps/index.d.ts +9 -16
  85. package/build-types/color-ramps/index.d.ts.map +1 -1
  86. package/build-types/color-ramps/lib/color-utils.d.ts +22 -0
  87. package/build-types/color-ramps/lib/color-utils.d.ts.map +1 -0
  88. package/build-types/color-ramps/lib/constants.d.ts +6 -8
  89. package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
  90. package/build-types/color-ramps/lib/default-ramps.d.ts +7 -0
  91. package/build-types/color-ramps/lib/default-ramps.d.ts.map +1 -0
  92. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +7 -5
  93. package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
  94. package/build-types/color-ramps/lib/index.d.ts +5 -2
  95. package/build-types/color-ramps/lib/index.d.ts.map +1 -1
  96. package/build-types/color-ramps/lib/register-color-spaces.d.ts +2 -0
  97. package/build-types/color-ramps/lib/register-color-spaces.d.ts.map +1 -0
  98. package/build-types/color-ramps/lib/taper-chroma.d.ts +7 -3
  99. package/build-types/color-ramps/lib/taper-chroma.d.ts.map +1 -1
  100. package/build-types/color-ramps/lib/utils.d.ts +7 -3
  101. package/build-types/color-ramps/lib/utils.d.ts.map +1 -1
  102. package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
  103. package/build-types/prebuilt/ts/design-tokens.d.ts.map +1 -1
  104. package/build-types/use-theme-provider-styles.d.ts +4 -0
  105. package/build-types/use-theme-provider-styles.d.ts.map +1 -1
  106. package/docs/ds-tokens.md +34 -0
  107. package/package.json +19 -9
  108. package/src/color-ramps/index.ts +24 -41
  109. package/src/color-ramps/lib/color-utils.ts +34 -0
  110. package/src/color-ramps/lib/constants.ts +8 -6
  111. package/src/color-ramps/lib/default-ramps.ts +200 -0
  112. package/src/color-ramps/lib/find-color-with-constraints.ts +70 -79
  113. package/src/color-ramps/lib/index.ts +27 -61
  114. package/src/color-ramps/lib/register-color-spaces.ts +13 -0
  115. package/src/color-ramps/lib/taper-chroma.ts +47 -19
  116. package/src/color-ramps/lib/utils.ts +8 -9
  117. package/src/color-ramps/stories/index.story.tsx +16 -22
  118. package/src/color-ramps/test/__snapshots__/index.test.ts.snap +96 -96
  119. package/src/color-ramps/test/index.test.ts +27 -15
  120. package/src/prebuilt/css/design-tokens.css +90 -32
  121. package/src/prebuilt/js/design-tokens.js +12 -0
  122. package/src/prebuilt/json/figma.json +214 -32
  123. package/src/prebuilt/ts/design-tokens.ts +36 -0
  124. package/src/use-theme-provider-styles.ts +47 -25
  125. package/tokens/color.json +184 -32
  126. package/tsconfig.bin.json +13 -0
  127. package/tsconfig.bin.tsbuildinfo +1 -0
  128. package/tsconfig.json +6 -4
  129. package/tsconfig.src.json +9 -0
  130. package/tsconfig.src.tsbuildinfo +1 -0
  131. package/bin/build-tokens.js +0 -83
  132. package/build/color-ramps/lib/cache-utils.js +0 -57
  133. package/build/color-ramps/lib/cache-utils.js.map +0 -7
  134. package/build/style.module.css.js +0 -2
  135. package/build-module/color-ramps/lib/cache-utils.js +0 -31
  136. package/build-module/color-ramps/lib/cache-utils.js.map +0 -7
  137. package/build-module/style.module.css.js +0 -1
  138. package/build-style/style.css +0 -3
  139. package/build-types/color-ramps/lib/cache-utils.d.ts +0 -22
  140. package/build-types/color-ramps/lib/cache-utils.d.ts.map +0 -1
  141. package/src/color-ramps/lib/cache-utils.ts +0 -56
  142. package/tsconfig.tsbuildinfo +0 -1
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "Color/_Primitives/Primary/surface5": {
59
59
  "value": {
60
- ".": "#d7dff3"
60
+ ".": "#d8e0f3"
61
61
  }
62
62
  },
63
63
  "Color/_Primitives/Primary/surface4": {
@@ -82,12 +82,12 @@
82
82
  },
83
83
  "Color/_Primitives/Primary/fgSurface2": {
84
84
  "value": {
85
- ".": "#577fff"
85
+ ".": "#5780ff"
86
86
  }
87
87
  },
88
88
  "Color/_Primitives/Primary/fgSurface1": {
89
89
  "value": {
90
- ".": "#81a6ff"
90
+ ".": "#81a7ff"
91
91
  }
92
92
  },
93
93
  "Color/_Primitives/Primary/stroke3": {
@@ -102,12 +102,12 @@
102
102
  },
103
103
  "Color/_Primitives/Primary/stroke2": {
104
104
  "value": {
105
- ".": "#7085c0"
105
+ ".": "#6f85c0"
106
106
  }
107
107
  },
108
108
  "Color/_Primitives/Primary/stroke1": {
109
109
  "value": {
110
- ".": "#93a4d0"
110
+ ".": "#92a4cf"
111
111
  }
112
112
  },
113
113
  "Color/_Primitives/Primary/bgFillDark": {
@@ -127,7 +127,7 @@
127
127
  },
128
128
  "Color/_Primitives/Primary/bgFillInverted1": {
129
129
  "value": {
130
- ".": "#1401a5"
130
+ ".": "#1401a4"
131
131
  }
132
132
  },
133
133
  "Color/_Primitives/Primary/fgFillInverted": {
@@ -162,17 +162,17 @@
162
162
  },
163
163
  "Color/_Primitives/Info/surface6": {
164
164
  "value": {
165
- ".": "#b9d3f0"
165
+ ".": "#bad3f0"
166
166
  }
167
167
  },
168
168
  "Color/_Primitives/Info/surface5": {
169
169
  "value": {
170
- ".": "#d0e1f5"
170
+ ".": "#d1e1f5"
171
171
  }
172
172
  },
173
173
  "Color/_Primitives/Info/surface4": {
174
174
  "value": {
175
- ".": "#e0ecf8"
175
+ ".": "#e1ecf8"
176
176
  }
177
177
  },
178
178
  "Color/_Primitives/Info/surface3": {
@@ -192,7 +192,7 @@
192
192
  },
193
193
  "Color/_Primitives/Info/fgSurface2": {
194
194
  "value": {
195
- ".": "#008bf9"
195
+ ".": "#008bfa"
196
196
  }
197
197
  },
198
198
  "Color/_Primitives/Info/fgSurface1": {
@@ -212,7 +212,7 @@
212
212
  },
213
213
  "Color/_Primitives/Info/stroke2": {
214
214
  "value": {
215
- ".": "#5c90c9"
215
+ ".": "#5e90c7"
216
216
  }
217
217
  },
218
218
  "Color/_Primitives/Info/stroke1": {
@@ -237,7 +237,7 @@
237
237
  },
238
238
  "Color/_Primitives/Info/bgFillInverted1": {
239
239
  "value": {
240
- ".": "#00297b"
240
+ ".": "#00297a"
241
241
  }
242
242
  },
243
243
  "Color/_Primitives/Info/fgFillInverted": {
@@ -277,12 +277,12 @@
277
277
  },
278
278
  "Color/_Primitives/Success/surface5": {
279
279
  "value": {
280
- ".": "#abf0b7"
280
+ ".": "#acf0b7"
281
281
  }
282
282
  },
283
283
  "Color/_Primitives/Success/surface4": {
284
284
  "value": {
285
- ".": "#cdf5d2"
285
+ ".": "#cdf5d3"
286
286
  }
287
287
  },
288
288
  "Color/_Primitives/Success/surface3": {
@@ -317,17 +317,17 @@
317
317
  },
318
318
  "Color/_Primitives/Success/stroke4": {
319
319
  "value": {
320
- ".": "#006013"
320
+ ".": "#006113"
321
321
  }
322
322
  },
323
323
  "Color/_Primitives/Success/stroke2": {
324
324
  "value": {
325
- ".": "#629a6c"
325
+ ".": "#62996c"
326
326
  }
327
327
  },
328
328
  "Color/_Primitives/Success/stroke1": {
329
329
  "value": {
330
- ".": "#78bb84"
330
+ ".": "#78ba84"
331
331
  }
332
332
  },
333
333
  "Color/_Primitives/Success/bgFillDark": {
@@ -347,7 +347,7 @@
347
347
  },
348
348
  "Color/_Primitives/Success/bgFillInverted1": {
349
349
  "value": {
350
- ".": "#003b00"
350
+ ".": "#003a00"
351
351
  }
352
352
  },
353
353
  "Color/_Primitives/Success/fgFillInverted": {
@@ -357,7 +357,7 @@
357
357
  },
358
358
  "Color/_Primitives/Success/surface1": {
359
359
  "value": {
360
- ".": "#ddf8e1"
360
+ ".": "#ddf8e0"
361
361
  }
362
362
  },
363
363
  "Color/_Primitives/Warning/bgFill1": {
@@ -372,7 +372,7 @@
372
372
  },
373
373
  "Color/_Primitives/Warning/bgFill2": {
374
374
  "value": {
375
- ".": "#dba32f"
375
+ ".": "#dba430"
376
376
  }
377
377
  },
378
378
  "Color/_Primitives/Warning/surface2": {
@@ -387,12 +387,12 @@
387
387
  },
388
388
  "Color/_Primitives/Warning/surface5": {
389
389
  "value": {
390
- ".": "#f5dcb2"
390
+ ".": "#f5ddb2"
391
391
  }
392
392
  },
393
393
  "Color/_Primitives/Warning/surface4": {
394
394
  "value": {
395
- ".": "#f8e8cd"
395
+ ".": "#f8e9cd"
396
396
  }
397
397
  },
398
398
  "Color/_Primitives/Warning/surface3": {
@@ -432,12 +432,12 @@
432
432
  },
433
433
  "Color/_Primitives/Warning/stroke2": {
434
434
  "value": {
435
- ".": "#a18a61"
435
+ ".": "#a08961"
436
436
  }
437
437
  },
438
438
  "Color/_Primitives/Warning/stroke1": {
439
439
  "value": {
440
- ".": "#c3a777"
440
+ ".": "#c2a777"
441
441
  }
442
442
  },
443
443
  "Color/_Primitives/Warning/bgFillDark": {
@@ -467,7 +467,7 @@
467
467
  },
468
468
  "Color/_Primitives/Warning/surface1": {
469
469
  "value": {
470
- ".": "#faefdc"
470
+ ".": "#faefdb"
471
471
  }
472
472
  },
473
473
  "Color/_Primitives/Error/bgFill1": {
@@ -492,7 +492,7 @@
492
492
  },
493
493
  "Color/_Primitives/Error/surface6": {
494
494
  "value": {
495
- ".": "#f5c5bd"
495
+ ".": "#f5c5be"
496
496
  }
497
497
  },
498
498
  "Color/_Primitives/Error/surface5": {
@@ -502,7 +502,7 @@
502
502
  },
503
503
  "Color/_Primitives/Error/surface4": {
504
504
  "value": {
505
- ".": "#fae5e2"
505
+ ".": "#fae6e2"
506
506
  }
507
507
  },
508
508
  "Color/_Primitives/Error/surface3": {
@@ -537,7 +537,7 @@
537
537
  },
538
538
  "Color/_Primitives/Error/stroke4": {
539
539
  "value": {
540
- ".": "#a30000"
540
+ ".": "#a40000"
541
541
  }
542
542
  },
543
543
  "Color/_Primitives/Error/stroke2": {
@@ -577,7 +577,7 @@
577
577
  },
578
578
  "Color/_Primitives/Error/surface1": {
579
579
  "value": {
580
- ".": "#fcedea"
580
+ ".": "#fcecea"
581
581
  }
582
582
  },
583
583
  "Color/_Primitives/Bg/surface2": {
@@ -627,7 +627,7 @@
627
627
  },
628
628
  "Color/_Primitives/Bg/fgSurface3": {
629
629
  "value": {
630
- ".": "#6c6c6c"
630
+ ".": "#6d6d6d"
631
631
  }
632
632
  },
633
633
  "Color/_Primitives/Bg/fgSurface2": {
@@ -652,7 +652,7 @@
652
652
  },
653
653
  "Color/_Primitives/Bg/stroke2": {
654
654
  "value": {
655
- ".": "#aeaeae"
655
+ ".": "#adadad"
656
656
  }
657
657
  },
658
658
  "Color/_Primitives/Bg/stroke1": {
@@ -687,7 +687,117 @@
687
687
  },
688
688
  "Color/_Primitives/Bg/surface1": {
689
689
  "value": {
690
- ".": "#efefef"
690
+ ".": "#f0f0f0"
691
+ }
692
+ },
693
+ "Color/_Primitives/Caution/bgFill1": {
694
+ "value": {
695
+ ".": "#f0d149"
696
+ }
697
+ },
698
+ "Color/_Primitives/Caution/fgFill": {
699
+ "value": {
700
+ ".": "#1f1e1b"
701
+ }
702
+ },
703
+ "Color/_Primitives/Caution/bgFill2": {
704
+ "value": {
705
+ ".": "#dabb2b"
706
+ }
707
+ },
708
+ "Color/_Primitives/Caution/surface2": {
709
+ "value": {
710
+ ".": "#fdf9e7"
711
+ }
712
+ },
713
+ "Color/_Primitives/Caution/surface6": {
714
+ "value": {
715
+ ".": "#e7d070"
716
+ }
717
+ },
718
+ "Color/_Primitives/Caution/surface5": {
719
+ "value": {
720
+ ".": "#f4e08c"
721
+ }
722
+ },
723
+ "Color/_Primitives/Caution/surface4": {
724
+ "value": {
725
+ ".": "#f8ebb6"
726
+ }
727
+ },
728
+ "Color/_Primitives/Caution/surface3": {
729
+ "value": {
730
+ ".": "#fff"
731
+ }
732
+ },
733
+ "Color/_Primitives/Caution/fgSurface4": {
734
+ "value": {
735
+ ".": "#291d00"
736
+ }
737
+ },
738
+ "Color/_Primitives/Caution/fgSurface3": {
739
+ "value": {
740
+ ".": "#866a00"
741
+ }
742
+ },
743
+ "Color/_Primitives/Caution/fgSurface2": {
744
+ "value": {
745
+ ".": "#a58700"
746
+ }
747
+ },
748
+ "Color/_Primitives/Caution/fgSurface1": {
749
+ "value": {
750
+ ".": "#c6a800"
751
+ }
752
+ },
753
+ "Color/_Primitives/Caution/stroke3": {
754
+ "value": {
755
+ ".": "#866a00"
756
+ }
757
+ },
758
+ "Color/_Primitives/Caution/stroke4": {
759
+ "value": {
760
+ ".": "#644e00"
761
+ }
762
+ },
763
+ "Color/_Primitives/Caution/stroke2": {
764
+ "value": {
765
+ ".": "#988d60"
766
+ }
767
+ },
768
+ "Color/_Primitives/Caution/stroke1": {
769
+ "value": {
770
+ ".": "#b8ab76"
771
+ }
772
+ },
773
+ "Color/_Primitives/Caution/bgFillDark": {
774
+ "value": {
775
+ ".": "#1f1e1b"
776
+ }
777
+ },
778
+ "Color/_Primitives/Caution/fgFillDark": {
779
+ "value": {
780
+ ".": "#f6f1da"
781
+ }
782
+ },
783
+ "Color/_Primitives/Caution/bgFillInverted2": {
784
+ "value": {
785
+ ".": "#1f1e1b"
786
+ }
787
+ },
788
+ "Color/_Primitives/Caution/bgFillInverted1": {
789
+ "value": {
790
+ ".": "#3d2d00"
791
+ }
792
+ },
793
+ "Color/_Primitives/Caution/fgFillInverted": {
794
+ "value": {
795
+ ".": "#f6f1da"
796
+ }
797
+ },
798
+ "Color/_Primitives/Caution/surface1": {
799
+ "value": {
800
+ ".": "#faf1cb"
691
801
  }
692
802
  },
693
803
  "Color/Semantic/Background/Neutral/bgSur-neutral": {
@@ -750,6 +860,18 @@
750
860
  },
751
861
  "description": "Background color for surfaces with warning tone and weak emphasis."
752
862
  },
863
+ "Color/Semantic/Background/Caution/bgSur-caution": {
864
+ "value": {
865
+ ".": "{Color/_Primitives/Caution/surface4}"
866
+ },
867
+ "description": "Background color for surfaces with caution tone and normal emphasis."
868
+ },
869
+ "Color/Semantic/Background/Caution/bgSur-caution-weak": {
870
+ "value": {
871
+ ".": "{Color/_Primitives/Caution/surface2}"
872
+ },
873
+ "description": "Background color for surfaces with caution tone and weak emphasis."
874
+ },
753
875
  "Color/Semantic/Background/Error/bgSur-error": {
754
876
  "value": {
755
877
  ".": "{Color/_Primitives/Error/surface4}"
@@ -924,6 +1046,66 @@
924
1046
  },
925
1047
  "description": "Foreground color for content like text with weak emphasis."
926
1048
  },
1049
+ "Color/Semantic/Foreground/Success/fgCon-success": {
1050
+ "value": {
1051
+ ".": "{Color/_Primitives/Success/fgSurface4}"
1052
+ },
1053
+ "description": "Foreground color for content like text with success tone and normal emphasis."
1054
+ },
1055
+ "Color/Semantic/Foreground/Success/fgCon-success-weak": {
1056
+ "value": {
1057
+ ".": "{Color/_Primitives/Success/fgSurface3}"
1058
+ },
1059
+ "description": "Foreground color for content like text with success tone and weak emphasis."
1060
+ },
1061
+ "Color/Semantic/Foreground/Info/fgCon-info": {
1062
+ "value": {
1063
+ ".": "{Color/_Primitives/Info/fgSurface4}"
1064
+ },
1065
+ "description": "Foreground color for content like text with info tone and normal emphasis."
1066
+ },
1067
+ "Color/Semantic/Foreground/Info/fgCon-info-weak": {
1068
+ "value": {
1069
+ ".": "{Color/_Primitives/Info/fgSurface3}"
1070
+ },
1071
+ "description": "Foreground color for content like text with info tone and weak emphasis."
1072
+ },
1073
+ "Color/Semantic/Foreground/Warning/fgCon-warning": {
1074
+ "value": {
1075
+ ".": "{Color/_Primitives/Warning/fgSurface4}"
1076
+ },
1077
+ "description": "Foreground color for content like text with warning tone and normal emphasis."
1078
+ },
1079
+ "Color/Semantic/Foreground/Warning/fgCon-warning-weak": {
1080
+ "value": {
1081
+ ".": "{Color/_Primitives/Warning/fgSurface3}"
1082
+ },
1083
+ "description": "Foreground color for content like text with warning tone and weak emphasis."
1084
+ },
1085
+ "Color/Semantic/Foreground/Caution/fgCon-caution": {
1086
+ "value": {
1087
+ ".": "{Color/_Primitives/Caution/fgSurface4}"
1088
+ },
1089
+ "description": "Foreground color for content like text with caution tone and normal emphasis."
1090
+ },
1091
+ "Color/Semantic/Foreground/Caution/fgCon-caution-weak": {
1092
+ "value": {
1093
+ ".": "{Color/_Primitives/Caution/fgSurface3}"
1094
+ },
1095
+ "description": "Foreground color for content like text with caution tone and weak emphasis."
1096
+ },
1097
+ "Color/Semantic/Foreground/Error/fgCon-error": {
1098
+ "value": {
1099
+ ".": "{Color/_Primitives/Error/fgSurface4}"
1100
+ },
1101
+ "description": "Foreground color for content like text with error tone and normal emphasis."
1102
+ },
1103
+ "Color/Semantic/Foreground/Error/fgCon-error-weak": {
1104
+ "value": {
1105
+ ".": "{Color/_Primitives/Error/fgSurface3}"
1106
+ },
1107
+ "description": "Foreground color for content like text with error tone and weak emphasis."
1108
+ },
927
1109
  "Color/Semantic/Foreground/Neutral/fgInt-neutral": {
928
1110
  "value": {
929
1111
  ".": "{Color/_Primitives/Bg/fgSurface4}"
@@ -50,6 +50,12 @@ export default {
50
50
  '--wpds-color-bg-surface-warning-weak': {
51
51
  '.': 'var(--wpds-color-private-warning-surface2)',
52
52
  },
53
+ '--wpds-color-bg-surface-caution': {
54
+ '.': 'var(--wpds-color-private-caution-surface4)',
55
+ },
56
+ '--wpds-color-bg-surface-caution-weak': {
57
+ '.': 'var(--wpds-color-private-caution-surface2)',
58
+ },
53
59
  '--wpds-color-bg-surface-error': {
54
60
  '.': 'var(--wpds-color-private-error-surface4)',
55
61
  },
@@ -137,6 +143,36 @@ export default {
137
143
  '--wpds-color-fg-content-neutral-weak': {
138
144
  '.': 'var(--wpds-color-private-bg-fg-surface3)',
139
145
  },
146
+ '--wpds-color-fg-content-success': {
147
+ '.': 'var(--wpds-color-private-success-fg-surface4)',
148
+ },
149
+ '--wpds-color-fg-content-success-weak': {
150
+ '.': 'var(--wpds-color-private-success-fg-surface3)',
151
+ },
152
+ '--wpds-color-fg-content-info': {
153
+ '.': 'var(--wpds-color-private-info-fg-surface4)',
154
+ },
155
+ '--wpds-color-fg-content-info-weak': {
156
+ '.': 'var(--wpds-color-private-info-fg-surface3)',
157
+ },
158
+ '--wpds-color-fg-content-warning': {
159
+ '.': 'var(--wpds-color-private-warning-fg-surface4)',
160
+ },
161
+ '--wpds-color-fg-content-warning-weak': {
162
+ '.': 'var(--wpds-color-private-warning-fg-surface3)',
163
+ },
164
+ '--wpds-color-fg-content-caution': {
165
+ '.': 'var(--wpds-color-private-caution-fg-surface4)',
166
+ },
167
+ '--wpds-color-fg-content-caution-weak': {
168
+ '.': 'var(--wpds-color-private-caution-fg-surface3)',
169
+ },
170
+ '--wpds-color-fg-content-error': {
171
+ '.': 'var(--wpds-color-private-error-fg-surface4)',
172
+ },
173
+ '--wpds-color-fg-content-error-weak': {
174
+ '.': 'var(--wpds-color-private-error-fg-surface3)',
175
+ },
140
176
  '--wpds-color-fg-interactive-neutral': {
141
177
  '.': 'var(--wpds-color-private-bg-fg-surface4)',
142
178
  },
@@ -2,7 +2,16 @@
2
2
  * External dependencies
3
3
  */
4
4
  import type { CSSProperties } from 'react';
5
- import Color from 'colorjs.io';
5
+ import {
6
+ parse,
7
+ to,
8
+ get,
9
+ serialize,
10
+ sRGB,
11
+ HSL,
12
+ type ColorTypes,
13
+ } from 'colorjs.io/fn';
14
+ import memoize from 'memize';
6
15
 
7
16
  /**
8
17
  * WordPress dependencies
@@ -12,6 +21,7 @@ import { useMemo, useContext } from '@wordpress/element';
12
21
  /**
13
22
  * Internal dependencies
14
23
  */
24
+ import './color-ramps/lib/register-color-spaces';
15
25
  import { ThemeContext } from './context';
16
26
  import semanticVariables from './prebuilt/ts/design-tokens';
17
27
  import {
@@ -24,6 +34,9 @@ import type { ThemeProviderProps } from './types';
24
34
 
25
35
  type Entry = [ string, string ];
26
36
 
37
+ const getCachedBgRamp = memoize( buildBgRamp, { maxSize: 10 } );
38
+ const getCachedAccentRamp = memoize( buildAccentRamp, { maxSize: 10 } );
39
+
27
40
  const legacyWpComponentsOverridesCSS: Entry[] = [
28
41
  [ '--wp-components-color-accent', 'var(--wp-admin-theme-color)' ],
29
42
  [
@@ -80,37 +93,49 @@ const legacyWpComponentsOverridesCSS: Entry[] = [
80
93
  ],
81
94
  ];
82
95
 
83
- function customRgbFormat( color: Color ) {
84
- const rgb = color.to( 'srgb' );
85
- return [ rgb.r, rgb.g, rgb.b ]
96
+ function customRgbFormat( color: ColorTypes ) {
97
+ const rgb = to( color, sRGB );
98
+ return [ get( rgb, 'srgb.r' ), get( rgb, 'srgb.g' ), get( rgb, 'srgb.b' ) ]
86
99
  .map( ( n ) => Math.round( n * 255 ) )
87
100
  .join( ', ' );
88
101
  }
89
102
 
90
103
  function legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {
91
- const parsedAccent = new Color( accent ).to( 'hsl' );
92
-
93
- const hsl = parsedAccent.coords;
94
- const darker10 = new Color( 'hsl', [
95
- hsl[ 0 ], // h
96
- hsl[ 1 ], // s
97
- Math.max( 0, Math.min( 100, hsl[ 2 ] - 5 ) ), // l (reduced by 5%)
98
- ] ).to( 'srgb' );
99
- const darker20 = new Color( 'hsl', [
100
- hsl[ 0 ], // h
101
- hsl[ 1 ], // s
102
- Math.max( 0, Math.min( 100, hsl[ 2 ] - 10 ) ), // l (reduced by 10%)
103
- ] ).to( 'srgb' );
104
+ const parsedAccent = to( parse( accent ), HSL );
105
+
106
+ const coords = parsedAccent.coords;
107
+ const darker10 = to(
108
+ {
109
+ space: HSL,
110
+ coords: [
111
+ coords[ 0 ], // h
112
+ coords[ 1 ], // s
113
+ Math.max( 0, Math.min( 100, coords[ 2 ] - 5 ) ), // l (reduced by 5%)
114
+ ],
115
+ },
116
+ sRGB
117
+ );
118
+ const darker20 = to(
119
+ {
120
+ space: HSL,
121
+ coords: [
122
+ coords[ 0 ], // h
123
+ coords[ 1 ], // s
124
+ Math.max( 0, Math.min( 100, coords[ 2 ] - 10 ) ), // l (reduced by 10%)
125
+ ],
126
+ },
127
+ sRGB
128
+ );
104
129
 
105
130
  return [
106
131
  [
107
132
  '--wp-admin-theme-color',
108
- parsedAccent.to( 'srgb' ).toString( { format: 'hex' } ),
133
+ serialize( to( parsedAccent, sRGB ), { format: 'hex' } ),
109
134
  ],
110
135
  [ '--wp-admin-theme-color--rgb', customRgbFormat( parsedAccent ) ],
111
136
  [
112
137
  '--wp-admin-theme-color-darker-10',
113
- darker10.toString( { format: 'hex' } ),
138
+ serialize( darker10, { format: 'hex' } ),
114
139
  ],
115
140
  [
116
141
  '--wp-admin-theme-color-darker-10--rgb',
@@ -118,7 +143,7 @@ function legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {
118
143
  ],
119
144
  [
120
145
  '--wp-admin-theme-color-darker-20',
121
- darker20.toString( { format: 'hex' } ),
146
+ serialize( darker20, { format: 'hex' } ),
122
147
  ],
123
148
  [
124
149
  '--wp-admin-theme-color-darker-20--rgb',
@@ -219,17 +244,14 @@ export function useThemeProviderStyles( {
219
244
 
220
245
  // Generate ramps.
221
246
  const computedColorRamps = new Map< string, RampResult >();
222
- const bgRamp = buildBgRamp( { seed: seeds.bg } );
247
+ const bgRamp = getCachedBgRamp( seeds.bg );
223
248
  Object.entries( seeds ).forEach( ( [ rampName, seed ] ) => {
224
249
  if ( rampName === 'bg' ) {
225
250
  computedColorRamps.set( rampName, bgRamp );
226
251
  } else {
227
252
  computedColorRamps.set(
228
253
  rampName,
229
- buildAccentRamp( {
230
- seed,
231
- bgRamp,
232
- } )
254
+ getCachedAccentRamp( seed, bgRamp )
233
255
  );
234
256
  }
235
257
  } );