@sanity/ui 2.8.13 → 2.9.0-canary.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.
- package/dist/_chunks-cjs/getTheme_v2.js +84 -28
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +84 -28
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +84 -28
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/index.esm.js +3187 -2978
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3188 -2980
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3187 -2978
- package/dist/index.mjs.map +1 -1
- package/dist/theme.esm.js +1197 -448
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +1197 -448
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +1197 -448
- package/dist/theme.mjs.map +1 -1
- package/package.json +27 -34
- package/src/core/components/autocomplete/autocomplete.tsx +42 -31
- package/src/core/components/menu/useMenuController.ts +18 -21
- package/src/core/components/tree/treeItem.tsx +13 -13
- package/src/core/hooks/useArrayProp.ts +14 -9
- package/src/core/hooks/useMatchMedia.ts +12 -22
- package/src/core/utils/portal/portalProvider.tsx +5 -5
package/dist/theme.esm.js
CHANGED
|
@@ -57,46 +57,226 @@ function _createSelectableStates(opts, base, dark, solid, muted, tone) {
|
|
|
57
57
|
function createSolidTones(opts, base, dark, name) {
|
|
58
58
|
return {
|
|
59
59
|
default: {
|
|
60
|
-
enabled: opts.solid({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
enabled: opts.solid({
|
|
61
|
+
base,
|
|
62
|
+
dark,
|
|
63
|
+
tone: "default",
|
|
64
|
+
name,
|
|
65
|
+
state: "enabled"
|
|
66
|
+
}),
|
|
67
|
+
disabled: opts.solid({
|
|
68
|
+
base,
|
|
69
|
+
dark,
|
|
70
|
+
tone: "default",
|
|
71
|
+
name,
|
|
72
|
+
state: "disabled"
|
|
73
|
+
}),
|
|
74
|
+
hovered: opts.solid({
|
|
75
|
+
base,
|
|
76
|
+
dark,
|
|
77
|
+
tone: "default",
|
|
78
|
+
name,
|
|
79
|
+
state: "hovered"
|
|
80
|
+
}),
|
|
81
|
+
pressed: opts.solid({
|
|
82
|
+
base,
|
|
83
|
+
dark,
|
|
84
|
+
tone: "default",
|
|
85
|
+
name,
|
|
86
|
+
state: "pressed"
|
|
87
|
+
}),
|
|
88
|
+
selected: opts.solid({
|
|
89
|
+
base,
|
|
90
|
+
dark,
|
|
91
|
+
tone: "default",
|
|
92
|
+
name,
|
|
93
|
+
state: "selected"
|
|
94
|
+
})
|
|
65
95
|
},
|
|
66
96
|
transparent: {
|
|
67
|
-
enabled: opts.solid({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
97
|
+
enabled: opts.solid({
|
|
98
|
+
base,
|
|
99
|
+
dark,
|
|
100
|
+
tone: "transparent",
|
|
101
|
+
name,
|
|
102
|
+
state: "enabled"
|
|
103
|
+
}),
|
|
104
|
+
disabled: opts.solid({
|
|
105
|
+
base,
|
|
106
|
+
dark,
|
|
107
|
+
tone: "transparent",
|
|
108
|
+
name,
|
|
109
|
+
state: "disabled"
|
|
110
|
+
}),
|
|
111
|
+
hovered: opts.solid({
|
|
112
|
+
base,
|
|
113
|
+
dark,
|
|
114
|
+
tone: "transparent",
|
|
115
|
+
name,
|
|
116
|
+
state: "hovered"
|
|
117
|
+
}),
|
|
118
|
+
pressed: opts.solid({
|
|
119
|
+
base,
|
|
120
|
+
dark,
|
|
121
|
+
tone: "transparent",
|
|
122
|
+
name,
|
|
123
|
+
state: "pressed"
|
|
124
|
+
}),
|
|
125
|
+
selected: opts.solid({
|
|
126
|
+
base,
|
|
127
|
+
dark,
|
|
128
|
+
tone: "transparent",
|
|
129
|
+
name,
|
|
130
|
+
state: "selected"
|
|
131
|
+
})
|
|
72
132
|
},
|
|
73
133
|
primary: {
|
|
74
|
-
enabled: opts.solid({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
134
|
+
enabled: opts.solid({
|
|
135
|
+
base,
|
|
136
|
+
dark,
|
|
137
|
+
tone: "primary",
|
|
138
|
+
name,
|
|
139
|
+
state: "enabled"
|
|
140
|
+
}),
|
|
141
|
+
disabled: opts.solid({
|
|
142
|
+
base,
|
|
143
|
+
dark,
|
|
144
|
+
tone: "primary",
|
|
145
|
+
name,
|
|
146
|
+
state: "disabled"
|
|
147
|
+
}),
|
|
148
|
+
hovered: opts.solid({
|
|
149
|
+
base,
|
|
150
|
+
dark,
|
|
151
|
+
tone: "primary",
|
|
152
|
+
name,
|
|
153
|
+
state: "hovered"
|
|
154
|
+
}),
|
|
155
|
+
pressed: opts.solid({
|
|
156
|
+
base,
|
|
157
|
+
dark,
|
|
158
|
+
tone: "primary",
|
|
159
|
+
name,
|
|
160
|
+
state: "pressed"
|
|
161
|
+
}),
|
|
162
|
+
selected: opts.solid({
|
|
163
|
+
base,
|
|
164
|
+
dark,
|
|
165
|
+
tone: "primary",
|
|
166
|
+
name,
|
|
167
|
+
state: "selected"
|
|
168
|
+
})
|
|
79
169
|
},
|
|
80
170
|
positive: {
|
|
81
|
-
enabled: opts.solid({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
171
|
+
enabled: opts.solid({
|
|
172
|
+
base,
|
|
173
|
+
dark,
|
|
174
|
+
tone: "positive",
|
|
175
|
+
name,
|
|
176
|
+
state: "enabled"
|
|
177
|
+
}),
|
|
178
|
+
disabled: opts.solid({
|
|
179
|
+
base,
|
|
180
|
+
dark,
|
|
181
|
+
tone: "positive",
|
|
182
|
+
name,
|
|
183
|
+
state: "disabled"
|
|
184
|
+
}),
|
|
185
|
+
hovered: opts.solid({
|
|
186
|
+
base,
|
|
187
|
+
dark,
|
|
188
|
+
tone: "positive",
|
|
189
|
+
name,
|
|
190
|
+
state: "hovered"
|
|
191
|
+
}),
|
|
192
|
+
pressed: opts.solid({
|
|
193
|
+
base,
|
|
194
|
+
dark,
|
|
195
|
+
tone: "positive",
|
|
196
|
+
name,
|
|
197
|
+
state: "pressed"
|
|
198
|
+
}),
|
|
199
|
+
selected: opts.solid({
|
|
200
|
+
base,
|
|
201
|
+
dark,
|
|
202
|
+
tone: "positive",
|
|
203
|
+
name,
|
|
204
|
+
state: "selected"
|
|
205
|
+
})
|
|
86
206
|
},
|
|
87
207
|
caution: {
|
|
88
|
-
enabled: opts.solid({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
208
|
+
enabled: opts.solid({
|
|
209
|
+
base,
|
|
210
|
+
dark,
|
|
211
|
+
tone: "caution",
|
|
212
|
+
name,
|
|
213
|
+
state: "enabled"
|
|
214
|
+
}),
|
|
215
|
+
disabled: opts.solid({
|
|
216
|
+
base,
|
|
217
|
+
dark,
|
|
218
|
+
tone: "caution",
|
|
219
|
+
name,
|
|
220
|
+
state: "disabled"
|
|
221
|
+
}),
|
|
222
|
+
hovered: opts.solid({
|
|
223
|
+
base,
|
|
224
|
+
dark,
|
|
225
|
+
tone: "caution",
|
|
226
|
+
name,
|
|
227
|
+
state: "hovered"
|
|
228
|
+
}),
|
|
229
|
+
pressed: opts.solid({
|
|
230
|
+
base,
|
|
231
|
+
dark,
|
|
232
|
+
tone: "caution",
|
|
233
|
+
name,
|
|
234
|
+
state: "pressed"
|
|
235
|
+
}),
|
|
236
|
+
selected: opts.solid({
|
|
237
|
+
base,
|
|
238
|
+
dark,
|
|
239
|
+
tone: "caution",
|
|
240
|
+
name,
|
|
241
|
+
state: "selected"
|
|
242
|
+
})
|
|
93
243
|
},
|
|
94
244
|
critical: {
|
|
95
|
-
enabled: opts.solid({
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
245
|
+
enabled: opts.solid({
|
|
246
|
+
base,
|
|
247
|
+
dark,
|
|
248
|
+
tone: "critical",
|
|
249
|
+
name,
|
|
250
|
+
state: "enabled"
|
|
251
|
+
}),
|
|
252
|
+
disabled: opts.solid({
|
|
253
|
+
base,
|
|
254
|
+
dark,
|
|
255
|
+
tone: "critical",
|
|
256
|
+
name,
|
|
257
|
+
state: "disabled"
|
|
258
|
+
}),
|
|
259
|
+
hovered: opts.solid({
|
|
260
|
+
base,
|
|
261
|
+
dark,
|
|
262
|
+
tone: "critical",
|
|
263
|
+
name,
|
|
264
|
+
state: "hovered"
|
|
265
|
+
}),
|
|
266
|
+
pressed: opts.solid({
|
|
267
|
+
base,
|
|
268
|
+
dark,
|
|
269
|
+
tone: "critical",
|
|
270
|
+
name,
|
|
271
|
+
state: "pressed"
|
|
272
|
+
}),
|
|
273
|
+
selected: opts.solid({
|
|
274
|
+
base,
|
|
275
|
+
dark,
|
|
276
|
+
tone: "critical",
|
|
277
|
+
name,
|
|
278
|
+
state: "selected"
|
|
279
|
+
})
|
|
100
280
|
}
|
|
101
281
|
};
|
|
102
282
|
}
|
|
@@ -287,7 +467,10 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
287
467
|
focusRing: [colors.critical.base, colors.critical.base]
|
|
288
468
|
}
|
|
289
469
|
}, defaultOpts = {
|
|
290
|
-
base: ({
|
|
470
|
+
base: ({
|
|
471
|
+
dark,
|
|
472
|
+
name
|
|
473
|
+
}) => name === "default" ? {
|
|
291
474
|
bg: dark ? black : white,
|
|
292
475
|
fg: dark ? white : black,
|
|
293
476
|
border: dark ? colors.default.darkest : colors.default.lightest,
|
|
@@ -318,7 +501,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
318
501
|
to: dark ? white : black
|
|
319
502
|
}
|
|
320
503
|
},
|
|
321
|
-
solid: ({
|
|
504
|
+
solid: ({
|
|
505
|
+
base,
|
|
506
|
+
dark,
|
|
507
|
+
state,
|
|
508
|
+
tone
|
|
509
|
+
}) => {
|
|
322
510
|
const color2 = colors[tone];
|
|
323
511
|
return state === "hovered" ? {
|
|
324
512
|
bg: dark ? color2.light : color2.dark,
|
|
@@ -362,7 +550,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
362
550
|
skeleton: base.skeleton
|
|
363
551
|
};
|
|
364
552
|
},
|
|
365
|
-
muted: ({
|
|
553
|
+
muted: ({
|
|
554
|
+
base,
|
|
555
|
+
dark,
|
|
556
|
+
state,
|
|
557
|
+
tone
|
|
558
|
+
}) => {
|
|
366
559
|
const color2 = colors[tone];
|
|
367
560
|
return state === "hovered" ? {
|
|
368
561
|
bg: dark ? color2.darker : color2.lighter,
|
|
@@ -406,7 +599,12 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
406
599
|
skeleton: base.skeleton
|
|
407
600
|
};
|
|
408
601
|
},
|
|
409
|
-
button: ({
|
|
602
|
+
button: ({
|
|
603
|
+
base,
|
|
604
|
+
mode,
|
|
605
|
+
muted,
|
|
606
|
+
solid
|
|
607
|
+
}) => mode === "bleed" ? {
|
|
410
608
|
...muted,
|
|
411
609
|
enabled: {
|
|
412
610
|
bg: "transparent",
|
|
@@ -454,7 +652,9 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
454
652
|
...solid,
|
|
455
653
|
enabled: muted.enabled
|
|
456
654
|
} : solid,
|
|
457
|
-
card: ({
|
|
655
|
+
card: ({
|
|
656
|
+
base
|
|
657
|
+
}) => ({
|
|
458
658
|
bg: black,
|
|
459
659
|
bg2: black,
|
|
460
660
|
fg: black,
|
|
@@ -482,8 +682,14 @@ const black = "hsl(0, 0%, 0%)", white = "hsl(0, 0%, 100%)", colors = {
|
|
|
482
682
|
border: black,
|
|
483
683
|
placeholder: black
|
|
484
684
|
}),
|
|
485
|
-
selectable: ({
|
|
486
|
-
|
|
685
|
+
selectable: ({
|
|
686
|
+
muted,
|
|
687
|
+
state,
|
|
688
|
+
tone
|
|
689
|
+
}) => muted[tone][state],
|
|
690
|
+
spot: ({
|
|
691
|
+
key
|
|
692
|
+
}) => spots[key],
|
|
487
693
|
syntax: () => ({
|
|
488
694
|
atrule: black,
|
|
489
695
|
attrName: black,
|
|
@@ -598,64 +804,283 @@ function createInputModes(opts, base, dark, solid, muted) {
|
|
|
598
804
|
function createMutedTones(opts, base, dark, name) {
|
|
599
805
|
return {
|
|
600
806
|
default: {
|
|
601
|
-
enabled: opts.muted({
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
807
|
+
enabled: opts.muted({
|
|
808
|
+
base,
|
|
809
|
+
dark,
|
|
810
|
+
tone: "default",
|
|
811
|
+
name,
|
|
812
|
+
state: "enabled"
|
|
813
|
+
}),
|
|
814
|
+
disabled: opts.muted({
|
|
815
|
+
base,
|
|
816
|
+
dark,
|
|
817
|
+
tone: "default",
|
|
818
|
+
name,
|
|
819
|
+
state: "disabled"
|
|
820
|
+
}),
|
|
821
|
+
hovered: opts.muted({
|
|
822
|
+
base,
|
|
823
|
+
dark,
|
|
824
|
+
tone: "default",
|
|
825
|
+
name,
|
|
826
|
+
state: "hovered"
|
|
827
|
+
}),
|
|
828
|
+
pressed: opts.muted({
|
|
829
|
+
base,
|
|
830
|
+
dark,
|
|
831
|
+
tone: "default",
|
|
832
|
+
name,
|
|
833
|
+
state: "pressed"
|
|
834
|
+
}),
|
|
835
|
+
selected: opts.muted({
|
|
836
|
+
base,
|
|
837
|
+
dark,
|
|
838
|
+
tone: "default",
|
|
839
|
+
name,
|
|
840
|
+
state: "selected"
|
|
841
|
+
})
|
|
606
842
|
},
|
|
607
843
|
transparent: {
|
|
608
|
-
enabled: opts.muted({
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
844
|
+
enabled: opts.muted({
|
|
845
|
+
base,
|
|
846
|
+
dark,
|
|
847
|
+
tone: "transparent",
|
|
848
|
+
name,
|
|
849
|
+
state: "enabled"
|
|
850
|
+
}),
|
|
851
|
+
disabled: opts.muted({
|
|
852
|
+
base,
|
|
853
|
+
dark,
|
|
854
|
+
tone: "transparent",
|
|
855
|
+
name,
|
|
856
|
+
state: "disabled"
|
|
857
|
+
}),
|
|
858
|
+
hovered: opts.muted({
|
|
859
|
+
base,
|
|
860
|
+
dark,
|
|
861
|
+
tone: "transparent",
|
|
862
|
+
name,
|
|
863
|
+
state: "hovered"
|
|
864
|
+
}),
|
|
865
|
+
pressed: opts.muted({
|
|
866
|
+
base,
|
|
867
|
+
dark,
|
|
868
|
+
tone: "transparent",
|
|
869
|
+
name,
|
|
870
|
+
state: "pressed"
|
|
871
|
+
}),
|
|
872
|
+
selected: opts.muted({
|
|
873
|
+
base,
|
|
874
|
+
dark,
|
|
875
|
+
tone: "transparent",
|
|
876
|
+
name,
|
|
877
|
+
state: "selected"
|
|
878
|
+
})
|
|
613
879
|
},
|
|
614
880
|
primary: {
|
|
615
|
-
enabled: opts.muted({
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
881
|
+
enabled: opts.muted({
|
|
882
|
+
base,
|
|
883
|
+
dark,
|
|
884
|
+
tone: "primary",
|
|
885
|
+
name,
|
|
886
|
+
state: "enabled"
|
|
887
|
+
}),
|
|
888
|
+
disabled: opts.muted({
|
|
889
|
+
base,
|
|
890
|
+
dark,
|
|
891
|
+
tone: "primary",
|
|
892
|
+
name,
|
|
893
|
+
state: "disabled"
|
|
894
|
+
}),
|
|
895
|
+
hovered: opts.muted({
|
|
896
|
+
base,
|
|
897
|
+
dark,
|
|
898
|
+
tone: "primary",
|
|
899
|
+
name,
|
|
900
|
+
state: "hovered"
|
|
901
|
+
}),
|
|
902
|
+
pressed: opts.muted({
|
|
903
|
+
base,
|
|
904
|
+
dark,
|
|
905
|
+
tone: "primary",
|
|
906
|
+
name,
|
|
907
|
+
state: "pressed"
|
|
908
|
+
}),
|
|
909
|
+
selected: opts.muted({
|
|
910
|
+
base,
|
|
911
|
+
dark,
|
|
912
|
+
tone: "primary",
|
|
913
|
+
name,
|
|
914
|
+
state: "selected"
|
|
915
|
+
})
|
|
620
916
|
},
|
|
621
917
|
positive: {
|
|
622
|
-
enabled: opts.muted({
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
918
|
+
enabled: opts.muted({
|
|
919
|
+
base,
|
|
920
|
+
dark,
|
|
921
|
+
tone: "positive",
|
|
922
|
+
name,
|
|
923
|
+
state: "enabled"
|
|
924
|
+
}),
|
|
925
|
+
disabled: opts.muted({
|
|
926
|
+
base,
|
|
927
|
+
dark,
|
|
928
|
+
tone: "positive",
|
|
929
|
+
name,
|
|
930
|
+
state: "disabled"
|
|
931
|
+
}),
|
|
932
|
+
hovered: opts.muted({
|
|
933
|
+
base,
|
|
934
|
+
dark,
|
|
935
|
+
tone: "positive",
|
|
936
|
+
name,
|
|
937
|
+
state: "hovered"
|
|
938
|
+
}),
|
|
939
|
+
pressed: opts.muted({
|
|
940
|
+
base,
|
|
941
|
+
dark,
|
|
942
|
+
tone: "positive",
|
|
943
|
+
name,
|
|
944
|
+
state: "pressed"
|
|
945
|
+
}),
|
|
946
|
+
selected: opts.muted({
|
|
947
|
+
base,
|
|
948
|
+
dark,
|
|
949
|
+
tone: "positive",
|
|
950
|
+
name,
|
|
951
|
+
state: "selected"
|
|
952
|
+
})
|
|
627
953
|
},
|
|
628
954
|
caution: {
|
|
629
|
-
enabled: opts.muted({
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
955
|
+
enabled: opts.muted({
|
|
956
|
+
base,
|
|
957
|
+
dark,
|
|
958
|
+
tone: "caution",
|
|
959
|
+
name,
|
|
960
|
+
state: "enabled"
|
|
961
|
+
}),
|
|
962
|
+
disabled: opts.muted({
|
|
963
|
+
base,
|
|
964
|
+
dark,
|
|
965
|
+
tone: "caution",
|
|
966
|
+
name,
|
|
967
|
+
state: "disabled"
|
|
968
|
+
}),
|
|
969
|
+
hovered: opts.muted({
|
|
970
|
+
base,
|
|
971
|
+
dark,
|
|
972
|
+
tone: "caution",
|
|
973
|
+
name,
|
|
974
|
+
state: "hovered"
|
|
975
|
+
}),
|
|
976
|
+
pressed: opts.muted({
|
|
977
|
+
base,
|
|
978
|
+
dark,
|
|
979
|
+
tone: "caution",
|
|
980
|
+
name,
|
|
981
|
+
state: "pressed"
|
|
982
|
+
}),
|
|
983
|
+
selected: opts.muted({
|
|
984
|
+
base,
|
|
985
|
+
dark,
|
|
986
|
+
tone: "caution",
|
|
987
|
+
name,
|
|
988
|
+
state: "selected"
|
|
989
|
+
})
|
|
634
990
|
},
|
|
635
991
|
critical: {
|
|
636
|
-
enabled: opts.muted({
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
992
|
+
enabled: opts.muted({
|
|
993
|
+
base,
|
|
994
|
+
dark,
|
|
995
|
+
tone: "critical",
|
|
996
|
+
name,
|
|
997
|
+
state: "enabled"
|
|
998
|
+
}),
|
|
999
|
+
disabled: opts.muted({
|
|
1000
|
+
base,
|
|
1001
|
+
dark,
|
|
1002
|
+
tone: "critical",
|
|
1003
|
+
name,
|
|
1004
|
+
state: "disabled"
|
|
1005
|
+
}),
|
|
1006
|
+
hovered: opts.muted({
|
|
1007
|
+
base,
|
|
1008
|
+
dark,
|
|
1009
|
+
tone: "critical",
|
|
1010
|
+
name,
|
|
1011
|
+
state: "hovered"
|
|
1012
|
+
}),
|
|
1013
|
+
pressed: opts.muted({
|
|
1014
|
+
base,
|
|
1015
|
+
dark,
|
|
1016
|
+
tone: "critical",
|
|
1017
|
+
name,
|
|
1018
|
+
state: "pressed"
|
|
1019
|
+
}),
|
|
1020
|
+
selected: opts.muted({
|
|
1021
|
+
base,
|
|
1022
|
+
dark,
|
|
1023
|
+
tone: "critical",
|
|
1024
|
+
name,
|
|
1025
|
+
state: "selected"
|
|
1026
|
+
})
|
|
641
1027
|
}
|
|
642
1028
|
};
|
|
643
1029
|
}
|
|
644
1030
|
function createSpot(opts, base, dark) {
|
|
645
1031
|
return {
|
|
646
|
-
gray: opts.spot({
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
1032
|
+
gray: opts.spot({
|
|
1033
|
+
base,
|
|
1034
|
+
dark,
|
|
1035
|
+
key: "gray"
|
|
1036
|
+
}),
|
|
1037
|
+
blue: opts.spot({
|
|
1038
|
+
base,
|
|
1039
|
+
dark,
|
|
1040
|
+
key: "blue"
|
|
1041
|
+
}),
|
|
1042
|
+
purple: opts.spot({
|
|
1043
|
+
base,
|
|
1044
|
+
dark,
|
|
1045
|
+
key: "purple"
|
|
1046
|
+
}),
|
|
1047
|
+
magenta: opts.spot({
|
|
1048
|
+
base,
|
|
1049
|
+
dark,
|
|
1050
|
+
key: "magenta"
|
|
1051
|
+
}),
|
|
1052
|
+
red: opts.spot({
|
|
1053
|
+
base,
|
|
1054
|
+
dark,
|
|
1055
|
+
key: "red"
|
|
1056
|
+
}),
|
|
1057
|
+
orange: opts.spot({
|
|
1058
|
+
base,
|
|
1059
|
+
dark,
|
|
1060
|
+
key: "orange"
|
|
1061
|
+
}),
|
|
1062
|
+
yellow: opts.spot({
|
|
1063
|
+
base,
|
|
1064
|
+
dark,
|
|
1065
|
+
key: "yellow"
|
|
1066
|
+
}),
|
|
1067
|
+
green: opts.spot({
|
|
1068
|
+
base,
|
|
1069
|
+
dark,
|
|
1070
|
+
key: "green"
|
|
1071
|
+
}),
|
|
1072
|
+
cyan: opts.spot({
|
|
1073
|
+
base,
|
|
1074
|
+
dark,
|
|
1075
|
+
key: "cyan"
|
|
1076
|
+
})
|
|
655
1077
|
};
|
|
656
1078
|
}
|
|
657
1079
|
function createColorTheme(partialOpts = {}) {
|
|
658
|
-
const builders = {
|
|
1080
|
+
const builders = {
|
|
1081
|
+
...defaultOpts,
|
|
1082
|
+
...partialOpts
|
|
1083
|
+
};
|
|
659
1084
|
return {
|
|
660
1085
|
light: _createColorScheme(builders, !1),
|
|
661
1086
|
dark: _createColorScheme(builders, !0)
|
|
@@ -672,7 +1097,10 @@ function _createColorScheme(opts, dark) {
|
|
|
672
1097
|
};
|
|
673
1098
|
}
|
|
674
1099
|
function _createColor(opts, dark, name) {
|
|
675
|
-
const base = opts.base({
|
|
1100
|
+
const base = opts.base({
|
|
1101
|
+
dark,
|
|
1102
|
+
name
|
|
1103
|
+
}), solid = createSolidTones(opts, base, dark, name), muted = createMutedTones(opts, base, dark, name);
|
|
676
1104
|
return {
|
|
677
1105
|
base,
|
|
678
1106
|
button: createButtonModes(opts, base, dark, solid, muted),
|
|
@@ -681,7 +1109,10 @@ function _createColor(opts, dark, name) {
|
|
|
681
1109
|
input: createInputModes(opts, base, dark, solid, muted),
|
|
682
1110
|
selectable: createSelectableTones(opts, base, dark, solid, muted),
|
|
683
1111
|
spot: createSpot(opts, base, dark),
|
|
684
|
-
syntax: opts.syntax({
|
|
1112
|
+
syntax: opts.syntax({
|
|
1113
|
+
base,
|
|
1114
|
+
dark
|
|
1115
|
+
}),
|
|
685
1116
|
solid,
|
|
686
1117
|
muted
|
|
687
1118
|
};
|
|
@@ -695,48 +1126,42 @@ const defaultThemeFonts = {
|
|
|
695
1126
|
semibold: 600,
|
|
696
1127
|
bold: 700
|
|
697
1128
|
},
|
|
698
|
-
sizes: [
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
fontSize: 22,
|
|
735
|
-
iconSize: 33,
|
|
736
|
-
lineHeight: 31,
|
|
737
|
-
letterSpacing: 0
|
|
738
|
-
}
|
|
739
|
-
]
|
|
1129
|
+
sizes: [{
|
|
1130
|
+
ascenderHeight: 4,
|
|
1131
|
+
descenderHeight: 4,
|
|
1132
|
+
fontSize: 10,
|
|
1133
|
+
iconSize: 17,
|
|
1134
|
+
lineHeight: 15,
|
|
1135
|
+
letterSpacing: 0
|
|
1136
|
+
}, {
|
|
1137
|
+
ascenderHeight: 5,
|
|
1138
|
+
descenderHeight: 5,
|
|
1139
|
+
fontSize: 13,
|
|
1140
|
+
iconSize: 21,
|
|
1141
|
+
lineHeight: 19,
|
|
1142
|
+
letterSpacing: 0
|
|
1143
|
+
}, {
|
|
1144
|
+
ascenderHeight: 6,
|
|
1145
|
+
descenderHeight: 6,
|
|
1146
|
+
fontSize: 16,
|
|
1147
|
+
iconSize: 25,
|
|
1148
|
+
lineHeight: 23,
|
|
1149
|
+
letterSpacing: 0
|
|
1150
|
+
}, {
|
|
1151
|
+
ascenderHeight: 7,
|
|
1152
|
+
descenderHeight: 7,
|
|
1153
|
+
fontSize: 19,
|
|
1154
|
+
iconSize: 29,
|
|
1155
|
+
lineHeight: 27,
|
|
1156
|
+
letterSpacing: 0
|
|
1157
|
+
}, {
|
|
1158
|
+
ascenderHeight: 8,
|
|
1159
|
+
descenderHeight: 8,
|
|
1160
|
+
fontSize: 22,
|
|
1161
|
+
iconSize: 33,
|
|
1162
|
+
lineHeight: 31,
|
|
1163
|
+
letterSpacing: 0
|
|
1164
|
+
}]
|
|
740
1165
|
},
|
|
741
1166
|
heading: {
|
|
742
1167
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -746,56 +1171,49 @@ const defaultThemeFonts = {
|
|
|
746
1171
|
semibold: 900,
|
|
747
1172
|
bold: 900
|
|
748
1173
|
},
|
|
749
|
-
sizes: [
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
descenderHeight: 9.5,
|
|
793
|
-
fontSize: 38,
|
|
794
|
-
iconSize: 53,
|
|
795
|
-
lineHeight: 47,
|
|
796
|
-
letterSpacing: 0
|
|
797
|
-
}
|
|
798
|
-
]
|
|
1174
|
+
sizes: [{
|
|
1175
|
+
ascenderHeight: 5,
|
|
1176
|
+
descenderHeight: 5,
|
|
1177
|
+
fontSize: 13,
|
|
1178
|
+
iconSize: 17,
|
|
1179
|
+
lineHeight: 19,
|
|
1180
|
+
letterSpacing: 0
|
|
1181
|
+
}, {
|
|
1182
|
+
ascenderHeight: 6,
|
|
1183
|
+
descenderHeight: 6,
|
|
1184
|
+
fontSize: 16,
|
|
1185
|
+
iconSize: 25,
|
|
1186
|
+
lineHeight: 23,
|
|
1187
|
+
letterSpacing: 0
|
|
1188
|
+
}, {
|
|
1189
|
+
ascenderHeight: 7,
|
|
1190
|
+
descenderHeight: 7,
|
|
1191
|
+
fontSize: 21,
|
|
1192
|
+
iconSize: 33,
|
|
1193
|
+
lineHeight: 29,
|
|
1194
|
+
letterSpacing: 0
|
|
1195
|
+
}, {
|
|
1196
|
+
ascenderHeight: 8,
|
|
1197
|
+
descenderHeight: 8,
|
|
1198
|
+
fontSize: 27,
|
|
1199
|
+
iconSize: 41,
|
|
1200
|
+
lineHeight: 35,
|
|
1201
|
+
letterSpacing: 0
|
|
1202
|
+
}, {
|
|
1203
|
+
ascenderHeight: 9.5,
|
|
1204
|
+
descenderHeight: 8.5,
|
|
1205
|
+
fontSize: 33,
|
|
1206
|
+
iconSize: 49,
|
|
1207
|
+
lineHeight: 41,
|
|
1208
|
+
letterSpacing: 0
|
|
1209
|
+
}, {
|
|
1210
|
+
ascenderHeight: 10.5,
|
|
1211
|
+
descenderHeight: 9.5,
|
|
1212
|
+
fontSize: 38,
|
|
1213
|
+
iconSize: 53,
|
|
1214
|
+
lineHeight: 47,
|
|
1215
|
+
letterSpacing: 0
|
|
1216
|
+
}]
|
|
799
1217
|
},
|
|
800
1218
|
label: {
|
|
801
1219
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
|
|
@@ -805,56 +1223,49 @@ const defaultThemeFonts = {
|
|
|
805
1223
|
semibold: 800,
|
|
806
1224
|
bold: 900
|
|
807
1225
|
},
|
|
808
|
-
sizes: [
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
descenderHeight: 2,
|
|
852
|
-
fontSize: 15,
|
|
853
|
-
iconSize: 23,
|
|
854
|
-
lineHeight: 15,
|
|
855
|
-
letterSpacing: 0.5
|
|
856
|
-
}
|
|
857
|
-
]
|
|
1226
|
+
sizes: [{
|
|
1227
|
+
ascenderHeight: 2,
|
|
1228
|
+
descenderHeight: 2,
|
|
1229
|
+
fontSize: 8.1,
|
|
1230
|
+
iconSize: 13,
|
|
1231
|
+
lineHeight: 10,
|
|
1232
|
+
letterSpacing: 0.5
|
|
1233
|
+
}, {
|
|
1234
|
+
ascenderHeight: 2,
|
|
1235
|
+
descenderHeight: 2,
|
|
1236
|
+
fontSize: 9.5,
|
|
1237
|
+
iconSize: 15,
|
|
1238
|
+
lineHeight: 11,
|
|
1239
|
+
letterSpacing: 0.5
|
|
1240
|
+
}, {
|
|
1241
|
+
ascenderHeight: 2,
|
|
1242
|
+
descenderHeight: 2,
|
|
1243
|
+
fontSize: 10.8,
|
|
1244
|
+
iconSize: 17,
|
|
1245
|
+
lineHeight: 12,
|
|
1246
|
+
letterSpacing: 0.5
|
|
1247
|
+
}, {
|
|
1248
|
+
ascenderHeight: 2,
|
|
1249
|
+
descenderHeight: 2,
|
|
1250
|
+
fontSize: 12.25,
|
|
1251
|
+
iconSize: 19,
|
|
1252
|
+
lineHeight: 13,
|
|
1253
|
+
letterSpacing: 0.5
|
|
1254
|
+
}, {
|
|
1255
|
+
ascenderHeight: 2,
|
|
1256
|
+
descenderHeight: 2,
|
|
1257
|
+
fontSize: 13.6,
|
|
1258
|
+
iconSize: 21,
|
|
1259
|
+
lineHeight: 14,
|
|
1260
|
+
letterSpacing: 0.5
|
|
1261
|
+
}, {
|
|
1262
|
+
ascenderHeight: 2,
|
|
1263
|
+
descenderHeight: 2,
|
|
1264
|
+
fontSize: 15,
|
|
1265
|
+
iconSize: 23,
|
|
1266
|
+
lineHeight: 15,
|
|
1267
|
+
letterSpacing: 0.5
|
|
1268
|
+
}]
|
|
858
1269
|
},
|
|
859
1270
|
text: {
|
|
860
1271
|
family: 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
@@ -864,48 +1275,42 @@ const defaultThemeFonts = {
|
|
|
864
1275
|
semibold: 600,
|
|
865
1276
|
bold: 700
|
|
866
1277
|
},
|
|
867
|
-
sizes: [
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
fontSize: 21,
|
|
904
|
-
iconSize: 33,
|
|
905
|
-
lineHeight: 31,
|
|
906
|
-
letterSpacing: 0
|
|
907
|
-
}
|
|
908
|
-
]
|
|
1278
|
+
sizes: [{
|
|
1279
|
+
ascenderHeight: 4,
|
|
1280
|
+
descenderHeight: 4,
|
|
1281
|
+
fontSize: 10,
|
|
1282
|
+
iconSize: 17,
|
|
1283
|
+
lineHeight: 15,
|
|
1284
|
+
letterSpacing: 0
|
|
1285
|
+
}, {
|
|
1286
|
+
ascenderHeight: 5,
|
|
1287
|
+
descenderHeight: 5,
|
|
1288
|
+
fontSize: 13,
|
|
1289
|
+
iconSize: 21,
|
|
1290
|
+
lineHeight: 19,
|
|
1291
|
+
letterSpacing: 0
|
|
1292
|
+
}, {
|
|
1293
|
+
ascenderHeight: 6,
|
|
1294
|
+
descenderHeight: 6,
|
|
1295
|
+
fontSize: 15,
|
|
1296
|
+
iconSize: 25,
|
|
1297
|
+
lineHeight: 23,
|
|
1298
|
+
letterSpacing: 0
|
|
1299
|
+
}, {
|
|
1300
|
+
ascenderHeight: 7,
|
|
1301
|
+
descenderHeight: 7,
|
|
1302
|
+
fontSize: 18,
|
|
1303
|
+
iconSize: 29,
|
|
1304
|
+
lineHeight: 27,
|
|
1305
|
+
letterSpacing: 0
|
|
1306
|
+
}, {
|
|
1307
|
+
ascenderHeight: 8,
|
|
1308
|
+
descenderHeight: 8,
|
|
1309
|
+
fontSize: 21,
|
|
1310
|
+
iconSize: 33,
|
|
1311
|
+
lineHeight: 31,
|
|
1312
|
+
letterSpacing: 0
|
|
1313
|
+
}]
|
|
909
1314
|
}
|
|
910
1315
|
};
|
|
911
1316
|
function is_v0(themeProp) {
|
|
@@ -1097,20 +1502,7 @@ function inputStateThemeColor_v2_v0(t) {
|
|
|
1097
1502
|
placeholder: t.placeholder
|
|
1098
1503
|
};
|
|
1099
1504
|
}
|
|
1100
|
-
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = [
|
|
1101
|
-
"transparent",
|
|
1102
|
-
"default",
|
|
1103
|
-
"primary",
|
|
1104
|
-
"positive",
|
|
1105
|
-
"caution",
|
|
1106
|
-
"critical"
|
|
1107
|
-
], THEME_COLOR_STATE_TONES = [
|
|
1108
|
-
"default",
|
|
1109
|
-
"primary",
|
|
1110
|
-
"positive",
|
|
1111
|
-
"caution",
|
|
1112
|
-
"critical"
|
|
1113
|
-
], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1505
|
+
const THEME_COLOR_SCHEMES = ["light", "dark"], THEME_COLOR_BLEND_MODES = ["multiply", "screen"], THEME_COLOR_CARD_TONES = ["transparent", "default", "primary", "positive", "caution", "critical"], THEME_COLOR_STATE_TONES = ["default", "primary", "positive", "caution", "critical"], THEME_COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"], THEME_COLOR_BUTTON_MODES = ["default", "ghost", "bleed"], THEME_COLOR_INPUT_MODES = ["default", "invalid"], THEME_COLOR_INPUT_STATES = ["enabled", "hovered", "readOnly", "disabled"], THEME_COLOR_AVATAR_COLORS = COLOR_HUES;
|
|
1114
1506
|
function isColorBlendModeValue(str) {
|
|
1115
1507
|
return THEME_COLOR_BLEND_MODES.includes(str);
|
|
1116
1508
|
}
|
|
@@ -1123,33 +1515,7 @@ function isColorTintKey(str) {
|
|
|
1123
1515
|
function isColorButtonMode(str) {
|
|
1124
1516
|
return THEME_COLOR_BUTTON_MODES.includes(str);
|
|
1125
1517
|
}
|
|
1126
|
-
const COLOR_CONFIG_STATE_KEYS = [
|
|
1127
|
-
"_hue",
|
|
1128
|
-
"bg",
|
|
1129
|
-
"fg",
|
|
1130
|
-
"border",
|
|
1131
|
-
"focusRing",
|
|
1132
|
-
"muted/fg",
|
|
1133
|
-
"accent/fg",
|
|
1134
|
-
"link/fg",
|
|
1135
|
-
"code/bg",
|
|
1136
|
-
"code/fg",
|
|
1137
|
-
"skeleton/from",
|
|
1138
|
-
"skeleton/to",
|
|
1139
|
-
"status/dot",
|
|
1140
|
-
"status/icon"
|
|
1141
|
-
], COLOR_CONFIG_CARD_KEYS = [
|
|
1142
|
-
...COLOR_CONFIG_STATE_KEYS,
|
|
1143
|
-
"_hue",
|
|
1144
|
-
"bg",
|
|
1145
|
-
"fg",
|
|
1146
|
-
"border",
|
|
1147
|
-
"focusRing",
|
|
1148
|
-
"shadow/outline",
|
|
1149
|
-
"shadow/umbra",
|
|
1150
|
-
"shadow/penumbra",
|
|
1151
|
-
"shadow/ambient"
|
|
1152
|
-
], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1518
|
+
const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "accent/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to", "status/dot", "status/icon"], COLOR_CONFIG_CARD_KEYS = [...COLOR_CONFIG_STATE_KEYS, "_hue", "bg", "fg", "border", "focusRing", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient"], COLOR_CONFIG_BLEND_KEYS = ["_blend"], COLOR_CONFIG_AVATAR_COLORS = ["*", ...THEME_COLOR_AVATAR_COLORS], COLOR_CONFIG_CARD_TONES = ["*", ...THEME_COLOR_CARD_TONES], COLOR_CONFIG_STATE_TONES = ["*", ...THEME_COLOR_STATE_TONES], COLOR_CONFIG_STATES = ["*", ...THEME_COLOR_STATES], COLOR_CONFIG_INPUT_MODES = ["*", ...THEME_COLOR_INPUT_MODES], COLOR_CONFIG_INPUT_STATES = ["*", ...THEME_COLOR_INPUT_STATES];
|
|
1153
1519
|
function parseTokenKey(str) {
|
|
1154
1520
|
const segments = str.split("/"), segment0 = segments.shift() || "";
|
|
1155
1521
|
if (isColorConfigBaseTone(segment0)) {
|
|
@@ -1315,10 +1681,16 @@ function compileColorTokenValue(node) {
|
|
|
1315
1681
|
}
|
|
1316
1682
|
const DEFAULT_COLOR_TOKEN_VALUE = ["500", "500"];
|
|
1317
1683
|
function resolveColorTokenValue(context, value = DEFAULT_COLOR_TOKEN_VALUE) {
|
|
1318
|
-
const {
|
|
1684
|
+
const {
|
|
1685
|
+
hue,
|
|
1686
|
+
scheme
|
|
1687
|
+
} = context, node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1319
1688
|
if (!node || node.type !== "color")
|
|
1320
1689
|
throw new Error(`Invalid color token: ${value[0]}`);
|
|
1321
|
-
return compileColorTokenValue({
|
|
1690
|
+
return compileColorTokenValue({
|
|
1691
|
+
...node,
|
|
1692
|
+
hue: node.hue || hue
|
|
1693
|
+
});
|
|
1322
1694
|
}
|
|
1323
1695
|
const defaultColorTokens = {
|
|
1324
1696
|
base: {
|
|
@@ -1393,16 +1765,24 @@ const defaultColorTokens = {
|
|
|
1393
1765
|
fg: ["600", "400"]
|
|
1394
1766
|
}
|
|
1395
1767
|
},
|
|
1396
|
-
primary: {
|
|
1768
|
+
primary: {
|
|
1769
|
+
_hue: "blue"
|
|
1770
|
+
},
|
|
1397
1771
|
positive: {
|
|
1398
1772
|
_hue: "green",
|
|
1399
|
-
shadow: {
|
|
1773
|
+
shadow: {
|
|
1774
|
+
outline: ["500/0.4", "500/0.4"]
|
|
1775
|
+
}
|
|
1400
1776
|
},
|
|
1401
1777
|
caution: {
|
|
1402
1778
|
_hue: "yellow",
|
|
1403
|
-
shadow: {
|
|
1779
|
+
shadow: {
|
|
1780
|
+
outline: ["600/0.3", "500/0.4"]
|
|
1781
|
+
}
|
|
1404
1782
|
},
|
|
1405
|
-
critical: {
|
|
1783
|
+
critical: {
|
|
1784
|
+
_hue: "red"
|
|
1785
|
+
}
|
|
1406
1786
|
},
|
|
1407
1787
|
button: {
|
|
1408
1788
|
default: {
|
|
@@ -1999,15 +2379,33 @@ function resolveBaseColorTones(inputTokens, tone) {
|
|
|
1999
2379
|
...spec,
|
|
2000
2380
|
_hue: hue,
|
|
2001
2381
|
avatar: {
|
|
2002
|
-
gray: merge({
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2382
|
+
gray: merge({
|
|
2383
|
+
_hue: "gray"
|
|
2384
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2385
|
+
blue: merge({
|
|
2386
|
+
_hue: "blue"
|
|
2387
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2388
|
+
purple: merge({
|
|
2389
|
+
_hue: "purple"
|
|
2390
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2391
|
+
magenta: merge({
|
|
2392
|
+
_hue: "magenta"
|
|
2393
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2394
|
+
red: merge({
|
|
2395
|
+
_hue: "red"
|
|
2396
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2397
|
+
orange: merge({
|
|
2398
|
+
_hue: "orange"
|
|
2399
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2400
|
+
yellow: merge({
|
|
2401
|
+
_hue: "yellow"
|
|
2402
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2403
|
+
green: merge({
|
|
2404
|
+
_hue: "green"
|
|
2405
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2406
|
+
cyan: merge({
|
|
2407
|
+
_hue: "cyan"
|
|
2408
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2011
2409
|
},
|
|
2012
2410
|
badge: {
|
|
2013
2411
|
default: {
|
|
@@ -2057,25 +2455,38 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
|
2057
2455
|
return tokens;
|
|
2058
2456
|
}
|
|
2059
2457
|
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2060
|
-
const spec = merge(
|
|
2061
|
-
inputTokens?.button?.[mode]?.["*"]?.["*"],
|
|
2062
|
-
inputTokens?.button?.[mode]?.[tone]?.["*"],
|
|
2063
|
-
inputTokens?.button?.[mode]?.["*"]?.[state],
|
|
2064
|
-
inputTokens?.button?.[mode]?.[tone]?.[state]
|
|
2065
|
-
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2458
|
+
const spec = merge(inputTokens?.button?.[mode]?.["*"]?.["*"], inputTokens?.button?.[mode]?.[tone]?.["*"], inputTokens?.button?.[mode]?.["*"]?.[state], inputTokens?.button?.[mode]?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2066
2459
|
return {
|
|
2067
2460
|
...spec,
|
|
2068
2461
|
_hue: hue,
|
|
2069
2462
|
avatar: {
|
|
2070
|
-
gray: merge({
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2463
|
+
gray: merge({
|
|
2464
|
+
_hue: "gray"
|
|
2465
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2466
|
+
blue: merge({
|
|
2467
|
+
_hue: "blue"
|
|
2468
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2469
|
+
purple: merge({
|
|
2470
|
+
_hue: "purple"
|
|
2471
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2472
|
+
magenta: merge({
|
|
2473
|
+
_hue: "magenta"
|
|
2474
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2475
|
+
red: merge({
|
|
2476
|
+
_hue: "red"
|
|
2477
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2478
|
+
orange: merge({
|
|
2479
|
+
_hue: "orange"
|
|
2480
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2481
|
+
yellow: merge({
|
|
2482
|
+
_hue: "yellow"
|
|
2483
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2484
|
+
green: merge({
|
|
2485
|
+
_hue: "green"
|
|
2486
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2487
|
+
cyan: merge({
|
|
2488
|
+
_hue: "cyan"
|
|
2489
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2079
2490
|
},
|
|
2080
2491
|
badge: {
|
|
2081
2492
|
default: {
|
|
@@ -2119,13 +2530,11 @@ function resolveInputModeColorTokens(inputTokens, mode) {
|
|
|
2119
2530
|
return states;
|
|
2120
2531
|
}
|
|
2121
2532
|
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2122
|
-
const spec = merge(
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2128
|
-
return { ...spec, _hue: hue };
|
|
2533
|
+
const spec = merge(inputTokens?.input?.["*"]?.["*"], inputTokens?.input?.[mode]?.["*"], inputTokens?.input?.["*"]?.[state], inputTokens?.input?.[mode]?.[state]), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2534
|
+
return {
|
|
2535
|
+
...spec,
|
|
2536
|
+
_hue: hue
|
|
2537
|
+
};
|
|
2129
2538
|
}
|
|
2130
2539
|
function resolveSelectableColorTokens(inputTokens) {
|
|
2131
2540
|
const tokens = {};
|
|
@@ -2142,25 +2551,38 @@ function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
|
2142
2551
|
return states;
|
|
2143
2552
|
}
|
|
2144
2553
|
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2145
|
-
const spec = merge(
|
|
2146
|
-
inputTokens?.selectable?.["*"]?.["*"],
|
|
2147
|
-
inputTokens?.selectable?.[tone]?.["*"],
|
|
2148
|
-
inputTokens?.selectable?.["*"]?.[state],
|
|
2149
|
-
inputTokens?.selectable?.[tone]?.[state]
|
|
2150
|
-
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2554
|
+
const spec = merge(inputTokens?.selectable?.["*"]?.["*"], inputTokens?.selectable?.[tone]?.["*"], inputTokens?.selectable?.["*"]?.[state], inputTokens?.selectable?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2151
2555
|
return {
|
|
2152
2556
|
...spec,
|
|
2153
2557
|
_hue: hue,
|
|
2154
2558
|
avatar: {
|
|
2155
|
-
gray: merge({
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2559
|
+
gray: merge({
|
|
2560
|
+
_hue: "gray"
|
|
2561
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2562
|
+
blue: merge({
|
|
2563
|
+
_hue: "blue"
|
|
2564
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2565
|
+
purple: merge({
|
|
2566
|
+
_hue: "purple"
|
|
2567
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2568
|
+
magenta: merge({
|
|
2569
|
+
_hue: "magenta"
|
|
2570
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2571
|
+
red: merge({
|
|
2572
|
+
_hue: "red"
|
|
2573
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2574
|
+
orange: merge({
|
|
2575
|
+
_hue: "orange"
|
|
2576
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2577
|
+
yellow: merge({
|
|
2578
|
+
_hue: "yellow"
|
|
2579
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2580
|
+
green: merge({
|
|
2581
|
+
_hue: "green"
|
|
2582
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2583
|
+
cyan: merge({
|
|
2584
|
+
_hue: "cyan"
|
|
2585
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2164
2586
|
},
|
|
2165
2587
|
badge: {
|
|
2166
2588
|
default: {
|
|
@@ -2197,35 +2619,71 @@ function buildColorTheme(config) {
|
|
|
2197
2619
|
color: resolveColorTokens(config?.color)
|
|
2198
2620
|
};
|
|
2199
2621
|
return {
|
|
2200
|
-
light: buildColorScheme({
|
|
2201
|
-
|
|
2622
|
+
light: buildColorScheme({
|
|
2623
|
+
scheme: "light"
|
|
2624
|
+
}, resolvedConfig),
|
|
2625
|
+
dark: buildColorScheme({
|
|
2626
|
+
scheme: "dark"
|
|
2627
|
+
}, resolvedConfig)
|
|
2202
2628
|
};
|
|
2203
2629
|
}
|
|
2204
2630
|
function buildColorScheme(options, config) {
|
|
2205
|
-
const {
|
|
2631
|
+
const {
|
|
2632
|
+
scheme
|
|
2633
|
+
} = options;
|
|
2206
2634
|
return {
|
|
2207
|
-
transparent: buildCardColorTheme({
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2635
|
+
transparent: buildCardColorTheme({
|
|
2636
|
+
scheme,
|
|
2637
|
+
tone: "transparent"
|
|
2638
|
+
}, config),
|
|
2639
|
+
default: buildCardColorTheme({
|
|
2640
|
+
scheme,
|
|
2641
|
+
tone: "default"
|
|
2642
|
+
}, config),
|
|
2643
|
+
primary: buildCardColorTheme({
|
|
2644
|
+
scheme,
|
|
2645
|
+
tone: "primary"
|
|
2646
|
+
}, config),
|
|
2647
|
+
positive: buildCardColorTheme({
|
|
2648
|
+
scheme,
|
|
2649
|
+
tone: "positive"
|
|
2650
|
+
}, config),
|
|
2651
|
+
caution: buildCardColorTheme({
|
|
2652
|
+
scheme,
|
|
2653
|
+
tone: "caution"
|
|
2654
|
+
}, config),
|
|
2655
|
+
critical: buildCardColorTheme({
|
|
2656
|
+
scheme,
|
|
2657
|
+
tone: "critical"
|
|
2658
|
+
}, config)
|
|
2213
2659
|
};
|
|
2214
2660
|
}
|
|
2215
2661
|
function buildCardColorTheme(options, config) {
|
|
2216
|
-
const {
|
|
2662
|
+
const {
|
|
2663
|
+
scheme,
|
|
2664
|
+
tone
|
|
2665
|
+
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
2666
|
+
hue: tokens?._hue || "gray",
|
|
2667
|
+
scheme
|
|
2668
|
+
};
|
|
2217
2669
|
return {
|
|
2218
2670
|
_blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
|
|
2219
2671
|
_dark: scheme === "dark",
|
|
2220
2672
|
accent: {
|
|
2221
2673
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2222
2674
|
},
|
|
2223
|
-
avatar: buildAvatarColorTheme({
|
|
2675
|
+
avatar: buildAvatarColorTheme({
|
|
2676
|
+
scheme
|
|
2677
|
+
}, tokens),
|
|
2224
2678
|
backdrop: resolveColorTokenValue(context, tokens?.backdrop),
|
|
2225
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2679
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2680
|
+
scheme
|
|
2681
|
+
}, config),
|
|
2226
2682
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2227
2683
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2228
|
-
button: buildButtonColorTheme({
|
|
2684
|
+
button: buildButtonColorTheme({
|
|
2685
|
+
scheme
|
|
2686
|
+
}, config),
|
|
2229
2687
|
code: {
|
|
2230
2688
|
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2231
2689
|
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
@@ -2233,7 +2691,10 @@ function buildCardColorTheme(options, config) {
|
|
|
2233
2691
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2234
2692
|
focusRing: resolveColorTokenValue(context, tokens?.focusRing),
|
|
2235
2693
|
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2236
|
-
input: buildInputColorTheme({
|
|
2694
|
+
input: buildInputColorTheme({
|
|
2695
|
+
scheme,
|
|
2696
|
+
tone
|
|
2697
|
+
}, config),
|
|
2237
2698
|
kbd: {
|
|
2238
2699
|
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2239
2700
|
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
@@ -2246,17 +2707,30 @@ function buildCardColorTheme(options, config) {
|
|
|
2246
2707
|
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2247
2708
|
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2248
2709
|
},
|
|
2249
|
-
selectable: buildSelectableColorTheme({
|
|
2250
|
-
|
|
2710
|
+
selectable: buildSelectableColorTheme({
|
|
2711
|
+
scheme
|
|
2712
|
+
}, config),
|
|
2713
|
+
shadow: buildShadowColorTheme({
|
|
2714
|
+
scheme,
|
|
2715
|
+
tone
|
|
2716
|
+
}, config),
|
|
2251
2717
|
skeleton: {
|
|
2252
2718
|
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2253
2719
|
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2254
2720
|
},
|
|
2255
|
-
syntax: buildSyntaxColorTheme({
|
|
2721
|
+
syntax: buildSyntaxColorTheme({
|
|
2722
|
+
scheme
|
|
2723
|
+
}, config)
|
|
2256
2724
|
};
|
|
2257
2725
|
}
|
|
2258
2726
|
function buildShadowColorTheme(options, config) {
|
|
2259
|
-
const {
|
|
2727
|
+
const {
|
|
2728
|
+
scheme,
|
|
2729
|
+
tone
|
|
2730
|
+
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
2731
|
+
hue: tokens?._hue || "gray",
|
|
2732
|
+
scheme
|
|
2733
|
+
};
|
|
2260
2734
|
return {
|
|
2261
2735
|
outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
|
|
2262
2736
|
umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
|
|
@@ -2265,21 +2739,56 @@ function buildShadowColorTheme(options, config) {
|
|
|
2265
2739
|
};
|
|
2266
2740
|
}
|
|
2267
2741
|
function buildAvatarColorTheme(options, stateTokens) {
|
|
2268
|
-
const {
|
|
2742
|
+
const {
|
|
2743
|
+
scheme
|
|
2744
|
+
} = options;
|
|
2269
2745
|
return {
|
|
2270
|
-
gray: _buildAvatarColorTheme({
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2746
|
+
gray: _buildAvatarColorTheme({
|
|
2747
|
+
color: "gray",
|
|
2748
|
+
scheme
|
|
2749
|
+
}, stateTokens),
|
|
2750
|
+
blue: _buildAvatarColorTheme({
|
|
2751
|
+
color: "blue",
|
|
2752
|
+
scheme
|
|
2753
|
+
}, stateTokens),
|
|
2754
|
+
purple: _buildAvatarColorTheme({
|
|
2755
|
+
color: "purple",
|
|
2756
|
+
scheme
|
|
2757
|
+
}, stateTokens),
|
|
2758
|
+
magenta: _buildAvatarColorTheme({
|
|
2759
|
+
color: "magenta",
|
|
2760
|
+
scheme
|
|
2761
|
+
}, stateTokens),
|
|
2762
|
+
red: _buildAvatarColorTheme({
|
|
2763
|
+
color: "red",
|
|
2764
|
+
scheme
|
|
2765
|
+
}, stateTokens),
|
|
2766
|
+
orange: _buildAvatarColorTheme({
|
|
2767
|
+
color: "orange",
|
|
2768
|
+
scheme
|
|
2769
|
+
}, stateTokens),
|
|
2770
|
+
yellow: _buildAvatarColorTheme({
|
|
2771
|
+
color: "yellow",
|
|
2772
|
+
scheme
|
|
2773
|
+
}, stateTokens),
|
|
2774
|
+
green: _buildAvatarColorTheme({
|
|
2775
|
+
color: "green",
|
|
2776
|
+
scheme
|
|
2777
|
+
}, stateTokens),
|
|
2778
|
+
cyan: _buildAvatarColorTheme({
|
|
2779
|
+
color: "cyan",
|
|
2780
|
+
scheme
|
|
2781
|
+
}, stateTokens)
|
|
2279
2782
|
};
|
|
2280
2783
|
}
|
|
2281
2784
|
function _buildAvatarColorTheme(options, stateTokens) {
|
|
2282
|
-
const {
|
|
2785
|
+
const {
|
|
2786
|
+
color: color2,
|
|
2787
|
+
scheme
|
|
2788
|
+
} = options, tokens = stateTokens?.avatar?.[color2], context = {
|
|
2789
|
+
hue: tokens?._hue || "gray",
|
|
2790
|
+
scheme
|
|
2791
|
+
};
|
|
2283
2792
|
return {
|
|
2284
2793
|
_blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
|
|
2285
2794
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2287,17 +2796,40 @@ function _buildAvatarColorTheme(options, stateTokens) {
|
|
|
2287
2796
|
};
|
|
2288
2797
|
}
|
|
2289
2798
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
2290
|
-
const {
|
|
2799
|
+
const {
|
|
2800
|
+
scheme
|
|
2801
|
+
} = options;
|
|
2291
2802
|
return {
|
|
2292
|
-
default: _buildBadgeColorTheme(tokens, {
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2803
|
+
default: _buildBadgeColorTheme(tokens, {
|
|
2804
|
+
scheme,
|
|
2805
|
+
tone: "default"
|
|
2806
|
+
}, config),
|
|
2807
|
+
primary: _buildBadgeColorTheme(tokens, {
|
|
2808
|
+
scheme,
|
|
2809
|
+
tone: "primary"
|
|
2810
|
+
}, config),
|
|
2811
|
+
positive: _buildBadgeColorTheme(tokens, {
|
|
2812
|
+
scheme,
|
|
2813
|
+
tone: "positive"
|
|
2814
|
+
}, config),
|
|
2815
|
+
caution: _buildBadgeColorTheme(tokens, {
|
|
2816
|
+
scheme,
|
|
2817
|
+
tone: "caution"
|
|
2818
|
+
}, config),
|
|
2819
|
+
critical: _buildBadgeColorTheme(tokens, {
|
|
2820
|
+
scheme,
|
|
2821
|
+
tone: "critical"
|
|
2822
|
+
}, config)
|
|
2297
2823
|
};
|
|
2298
2824
|
}
|
|
2299
2825
|
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2300
|
-
const {
|
|
2826
|
+
const {
|
|
2827
|
+
scheme,
|
|
2828
|
+
tone
|
|
2829
|
+
} = options, tokens = parentTokens?.[tone], context = {
|
|
2830
|
+
hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray",
|
|
2831
|
+
scheme
|
|
2832
|
+
};
|
|
2301
2833
|
return {
|
|
2302
2834
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2303
2835
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
@@ -2306,32 +2838,65 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
|
2306
2838
|
};
|
|
2307
2839
|
}
|
|
2308
2840
|
function buildButtonColorTheme(options, config) {
|
|
2309
|
-
const {
|
|
2841
|
+
const {
|
|
2842
|
+
scheme
|
|
2843
|
+
} = options, modes = {};
|
|
2310
2844
|
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2311
|
-
modes[mode] = buildButtonTonesColorTheme({
|
|
2845
|
+
modes[mode] = buildButtonTonesColorTheme({
|
|
2846
|
+
scheme,
|
|
2847
|
+
mode
|
|
2848
|
+
}, config);
|
|
2312
2849
|
return modes;
|
|
2313
2850
|
}
|
|
2314
2851
|
function buildButtonTonesColorTheme(options, config) {
|
|
2315
|
-
const {
|
|
2852
|
+
const {
|
|
2853
|
+
mode,
|
|
2854
|
+
scheme
|
|
2855
|
+
} = options, tones2 = {};
|
|
2316
2856
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2317
|
-
tones2[tone] = buildButtonStatesColorTheme({
|
|
2857
|
+
tones2[tone] = buildButtonStatesColorTheme({
|
|
2858
|
+
mode,
|
|
2859
|
+
scheme,
|
|
2860
|
+
tone
|
|
2861
|
+
}, config);
|
|
2318
2862
|
return tones2;
|
|
2319
2863
|
}
|
|
2320
2864
|
function buildButtonStatesColorTheme(options, config) {
|
|
2321
|
-
const {
|
|
2865
|
+
const {
|
|
2866
|
+
mode,
|
|
2867
|
+
scheme,
|
|
2868
|
+
tone
|
|
2869
|
+
} = options, states = {};
|
|
2322
2870
|
for (const state of THEME_COLOR_STATES)
|
|
2323
|
-
states[state] = buildButtonStateColorTheme({
|
|
2871
|
+
states[state] = buildButtonStateColorTheme({
|
|
2872
|
+
mode,
|
|
2873
|
+
tone,
|
|
2874
|
+
scheme,
|
|
2875
|
+
state
|
|
2876
|
+
}, config);
|
|
2324
2877
|
return states;
|
|
2325
2878
|
}
|
|
2326
2879
|
function buildButtonStateColorTheme(options, config) {
|
|
2327
|
-
const {
|
|
2880
|
+
const {
|
|
2881
|
+
mode,
|
|
2882
|
+
tone,
|
|
2883
|
+
scheme,
|
|
2884
|
+
state
|
|
2885
|
+
} = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2886
|
+
hue,
|
|
2887
|
+
scheme
|
|
2888
|
+
};
|
|
2328
2889
|
return {
|
|
2329
2890
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2330
2891
|
accent: {
|
|
2331
2892
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2332
2893
|
},
|
|
2333
|
-
avatar: buildAvatarColorTheme({
|
|
2334
|
-
|
|
2894
|
+
avatar: buildAvatarColorTheme({
|
|
2895
|
+
scheme
|
|
2896
|
+
}, tokens),
|
|
2897
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2898
|
+
scheme
|
|
2899
|
+
}, config),
|
|
2335
2900
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2336
2901
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2337
2902
|
code: {
|
|
@@ -2359,23 +2924,66 @@ function buildButtonStateColorTheme(options, config) {
|
|
|
2359
2924
|
};
|
|
2360
2925
|
}
|
|
2361
2926
|
function buildInputColorTheme(options, config) {
|
|
2362
|
-
const {
|
|
2927
|
+
const {
|
|
2928
|
+
scheme,
|
|
2929
|
+
tone
|
|
2930
|
+
} = options;
|
|
2363
2931
|
return {
|
|
2364
|
-
default: buildInputStatesColorTheme({
|
|
2365
|
-
|
|
2932
|
+
default: buildInputStatesColorTheme({
|
|
2933
|
+
mode: "default",
|
|
2934
|
+
scheme,
|
|
2935
|
+
tone
|
|
2936
|
+
}, config),
|
|
2937
|
+
invalid: buildInputStatesColorTheme({
|
|
2938
|
+
mode: "invalid",
|
|
2939
|
+
scheme,
|
|
2940
|
+
tone
|
|
2941
|
+
}, config)
|
|
2366
2942
|
};
|
|
2367
2943
|
}
|
|
2368
2944
|
function buildInputStatesColorTheme(options, config) {
|
|
2369
|
-
const {
|
|
2945
|
+
const {
|
|
2946
|
+
mode,
|
|
2947
|
+
scheme,
|
|
2948
|
+
tone
|
|
2949
|
+
} = options;
|
|
2370
2950
|
return {
|
|
2371
|
-
enabled: buildInputStateColorTheme({
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2951
|
+
enabled: buildInputStateColorTheme({
|
|
2952
|
+
mode,
|
|
2953
|
+
scheme,
|
|
2954
|
+
state: "enabled",
|
|
2955
|
+
tone
|
|
2956
|
+
}, config),
|
|
2957
|
+
hovered: buildInputStateColorTheme({
|
|
2958
|
+
mode,
|
|
2959
|
+
scheme,
|
|
2960
|
+
state: "hovered",
|
|
2961
|
+
tone
|
|
2962
|
+
}, config),
|
|
2963
|
+
readOnly: buildInputStateColorTheme({
|
|
2964
|
+
mode,
|
|
2965
|
+
scheme,
|
|
2966
|
+
state: "readOnly",
|
|
2967
|
+
tone
|
|
2968
|
+
}, config),
|
|
2969
|
+
disabled: buildInputStateColorTheme({
|
|
2970
|
+
mode,
|
|
2971
|
+
scheme,
|
|
2972
|
+
state: "disabled",
|
|
2973
|
+
tone
|
|
2974
|
+
}, config)
|
|
2375
2975
|
};
|
|
2376
2976
|
}
|
|
2377
2977
|
function buildInputStateColorTheme(options, config) {
|
|
2378
|
-
const {
|
|
2978
|
+
const {
|
|
2979
|
+
mode,
|
|
2980
|
+
tone,
|
|
2981
|
+
scheme,
|
|
2982
|
+
state
|
|
2983
|
+
} = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2984
|
+
hue,
|
|
2985
|
+
scheme
|
|
2986
|
+
};
|
|
2379
2987
|
return {
|
|
2380
2988
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2381
2989
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2388,26 +2996,49 @@ function buildInputStateColorTheme(options, config) {
|
|
|
2388
2996
|
};
|
|
2389
2997
|
}
|
|
2390
2998
|
function buildSelectableColorTheme(options, config) {
|
|
2391
|
-
const {
|
|
2999
|
+
const {
|
|
3000
|
+
scheme
|
|
3001
|
+
} = options, tones2 = {};
|
|
2392
3002
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2393
|
-
tones2[tone] = buildSelectableStatesColorTheme({
|
|
3003
|
+
tones2[tone] = buildSelectableStatesColorTheme({
|
|
3004
|
+
scheme,
|
|
3005
|
+
tone
|
|
3006
|
+
}, config);
|
|
2394
3007
|
return tones2;
|
|
2395
3008
|
}
|
|
2396
3009
|
function buildSelectableStatesColorTheme(options, config) {
|
|
2397
|
-
const {
|
|
3010
|
+
const {
|
|
3011
|
+
scheme,
|
|
3012
|
+
tone
|
|
3013
|
+
} = options, states = {};
|
|
2398
3014
|
for (const state of THEME_COLOR_STATES)
|
|
2399
|
-
states[state] = buildSelectableStateColorTheme({
|
|
3015
|
+
states[state] = buildSelectableStateColorTheme({
|
|
3016
|
+
tone,
|
|
3017
|
+
scheme,
|
|
3018
|
+
state
|
|
3019
|
+
}, config);
|
|
2400
3020
|
return states;
|
|
2401
3021
|
}
|
|
2402
3022
|
function buildSelectableStateColorTheme(options, config) {
|
|
2403
|
-
const {
|
|
3023
|
+
const {
|
|
3024
|
+
scheme,
|
|
3025
|
+
state,
|
|
3026
|
+
tone
|
|
3027
|
+
} = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
3028
|
+
hue,
|
|
3029
|
+
scheme
|
|
3030
|
+
};
|
|
2404
3031
|
return {
|
|
2405
3032
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2406
3033
|
accent: {
|
|
2407
3034
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2408
3035
|
},
|
|
2409
|
-
avatar: buildAvatarColorTheme({
|
|
2410
|
-
|
|
3036
|
+
avatar: buildAvatarColorTheme({
|
|
3037
|
+
scheme
|
|
3038
|
+
}, tokens),
|
|
3039
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
3040
|
+
scheme
|
|
3041
|
+
}, config),
|
|
2411
3042
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2412
3043
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2413
3044
|
code: {
|
|
@@ -2435,7 +3066,12 @@ function buildSelectableStateColorTheme(options, config) {
|
|
|
2435
3066
|
};
|
|
2436
3067
|
}
|
|
2437
3068
|
function buildSyntaxColorTheme(options, config) {
|
|
2438
|
-
const {
|
|
3069
|
+
const {
|
|
3070
|
+
scheme
|
|
3071
|
+
} = options, tokens = config?.color?.syntax, context = {
|
|
3072
|
+
hue: "gray",
|
|
3073
|
+
scheme
|
|
3074
|
+
};
|
|
2439
3075
|
return {
|
|
2440
3076
|
atrule: resolveColorTokenValue(context, tokens?.atrule),
|
|
2441
3077
|
attrName: resolveColorTokenValue(context, tokens?.attrName),
|
|
@@ -2550,11 +3186,19 @@ function rgbToHex(color2) {
|
|
|
2550
3186
|
const r = round(clamp(Math.round(color2.r), 0, 255)), g = round(clamp(Math.round(color2.g), 0, 255)), b = round(clamp(Math.round(color2.b), 0, 255));
|
|
2551
3187
|
return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
2552
3188
|
}
|
|
2553
|
-
function rgbToHsl({
|
|
3189
|
+
function rgbToHsl({
|
|
3190
|
+
r,
|
|
3191
|
+
g,
|
|
3192
|
+
b
|
|
3193
|
+
}) {
|
|
2554
3194
|
r /= 255, g /= 255, b /= 255;
|
|
2555
3195
|
const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
|
|
2556
3196
|
let h = 0, s = 0, l = 0;
|
|
2557
|
-
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), {
|
|
3197
|
+
return delta == 0 ? h = 0 : cmax == r ? h = (g - b) / delta % 6 : cmax == g ? h = (b - r) / delta + 2 : h = (r - g) / delta + 4, h = Math.round(h * 60), h < 0 && (h += 360), l = (cmax + cmin) / 2, s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(s * 100).toFixed(1), l = +(l * 100).toFixed(1), {
|
|
3198
|
+
h,
|
|
3199
|
+
s,
|
|
3200
|
+
l
|
|
3201
|
+
};
|
|
2558
3202
|
}
|
|
2559
3203
|
function hslToRgb(hsl) {
|
|
2560
3204
|
const s = hsl.s / 100, l = hsl.l / 100, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hsl.h / 60 % 2 - 1)), m = l - c / 2;
|
|
@@ -2579,10 +3223,18 @@ function parseHsl(str) {
|
|
|
2579
3223
|
const res = HSL_RE.exec(str);
|
|
2580
3224
|
if (!res)
|
|
2581
3225
|
throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
|
|
2582
|
-
return {
|
|
3226
|
+
return {
|
|
3227
|
+
h: parseInt(res[1]),
|
|
3228
|
+
s: parseFloat(res[3]),
|
|
3229
|
+
l: parseFloat(res[5])
|
|
3230
|
+
};
|
|
2583
3231
|
}
|
|
2584
3232
|
function parseColor(color2) {
|
|
2585
|
-
if (!color2) return {
|
|
3233
|
+
if (!color2) return {
|
|
3234
|
+
r: 0,
|
|
3235
|
+
g: 0,
|
|
3236
|
+
b: 0
|
|
3237
|
+
};
|
|
2586
3238
|
if (typeof color2 != "string")
|
|
2587
3239
|
throw new Error("parseColor: expected a string");
|
|
2588
3240
|
if (isHex(color2))
|
|
@@ -2597,7 +3249,11 @@ function getContrastRatio(bg, fg) {
|
|
|
2597
3249
|
const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|
|
2598
3250
|
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
2599
3251
|
}
|
|
2600
|
-
function rgb_lrgb({
|
|
3252
|
+
function rgb_lrgb({
|
|
3253
|
+
r,
|
|
3254
|
+
g,
|
|
3255
|
+
b
|
|
3256
|
+
}) {
|
|
2601
3257
|
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
2602
3258
|
}
|
|
2603
3259
|
function rgb_lrgb1(v) {
|
|
@@ -2612,7 +3268,9 @@ function rgba(color2, a) {
|
|
|
2612
3268
|
}
|
|
2613
3269
|
const RGB_RANGE = [0, 255];
|
|
2614
3270
|
function mixThemeColor(value, options) {
|
|
2615
|
-
const {
|
|
3271
|
+
const {
|
|
3272
|
+
blendMode
|
|
3273
|
+
} = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
|
|
2616
3274
|
r: [black2.r, white2.r],
|
|
2617
3275
|
g: [black2.g, white2.g],
|
|
2618
3276
|
b: [black2.b, white2.b]
|
|
@@ -2632,7 +3290,11 @@ function mixThemeColor(value, options) {
|
|
|
2632
3290
|
return rgbToHex(v);
|
|
2633
3291
|
}
|
|
2634
3292
|
function renderColorValue(str, options) {
|
|
2635
|
-
const {
|
|
3293
|
+
const {
|
|
3294
|
+
bg,
|
|
3295
|
+
blendMode,
|
|
3296
|
+
colorPalette
|
|
3297
|
+
} = options;
|
|
2636
3298
|
if (bg === "white")
|
|
2637
3299
|
throw new Error("Cannot blend with white background");
|
|
2638
3300
|
const node = parseTokenValue(str);
|
|
@@ -2669,17 +3331,31 @@ function renderThemeColorSchemes(value, config) {
|
|
|
2669
3331
|
};
|
|
2670
3332
|
}
|
|
2671
3333
|
function renderThemeColorScheme(colorPalette, value) {
|
|
2672
|
-
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3334
|
+
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3335
|
+
colorPalette
|
|
3336
|
+
}), renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
3337
|
+
colorPalette
|
|
3338
|
+
}), bg = renderedDefaultTone.bg;
|
|
2673
3339
|
if (bg === "white")
|
|
2674
3340
|
throw new Error("Cannot blend with white background");
|
|
2675
|
-
return Object.fromEntries([
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
]);
|
|
3341
|
+
return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, {
|
|
3342
|
+
bg,
|
|
3343
|
+
colorPalette
|
|
3344
|
+
})])]);
|
|
2680
3345
|
}
|
|
2681
3346
|
function renderThemeColor(value, options) {
|
|
2682
|
-
const {
|
|
3347
|
+
const {
|
|
3348
|
+
colorPalette,
|
|
3349
|
+
bg
|
|
3350
|
+
} = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, {
|
|
3351
|
+
colorPalette,
|
|
3352
|
+
bg,
|
|
3353
|
+
blendMode
|
|
3354
|
+
}), colorOptions = {
|
|
3355
|
+
colorPalette,
|
|
3356
|
+
bg: baseBg,
|
|
3357
|
+
blendMode
|
|
3358
|
+
}, button = renderThemeColorButton(value.button, {
|
|
2683
3359
|
baseBg,
|
|
2684
3360
|
blendMode,
|
|
2685
3361
|
colorPalette
|
|
@@ -2692,17 +3368,26 @@ function renderThemeColor(value, options) {
|
|
|
2692
3368
|
umbra: renderColorValue(value.shadow.umbra, {
|
|
2693
3369
|
...colorOptions,
|
|
2694
3370
|
bg: void 0,
|
|
2695
|
-
colorPalette: {
|
|
3371
|
+
colorPalette: {
|
|
3372
|
+
...colorPalette,
|
|
3373
|
+
black: "#000000"
|
|
3374
|
+
}
|
|
2696
3375
|
}),
|
|
2697
3376
|
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
2698
3377
|
...colorOptions,
|
|
2699
3378
|
bg: void 0,
|
|
2700
|
-
colorPalette: {
|
|
3379
|
+
colorPalette: {
|
|
3380
|
+
...colorPalette,
|
|
3381
|
+
black: "#000000"
|
|
3382
|
+
}
|
|
2701
3383
|
}),
|
|
2702
3384
|
ambient: renderColorValue(value.shadow.ambient, {
|
|
2703
3385
|
...colorOptions,
|
|
2704
3386
|
bg: void 0,
|
|
2705
|
-
colorPalette: {
|
|
3387
|
+
colorPalette: {
|
|
3388
|
+
...colorPalette,
|
|
3389
|
+
black: "#000000"
|
|
3390
|
+
}
|
|
2706
3391
|
})
|
|
2707
3392
|
};
|
|
2708
3393
|
return {
|
|
@@ -2711,9 +3396,17 @@ function renderThemeColor(value, options) {
|
|
|
2711
3396
|
accent: {
|
|
2712
3397
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2713
3398
|
},
|
|
2714
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3399
|
+
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3400
|
+
baseBg,
|
|
3401
|
+
colorPalette,
|
|
3402
|
+
blendMode
|
|
3403
|
+
}),
|
|
2715
3404
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
2716
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
3405
|
+
badge: renderThemeColorBadge(value.badge, {
|
|
3406
|
+
baseBg,
|
|
3407
|
+
colorPalette,
|
|
3408
|
+
blendMode
|
|
3409
|
+
}),
|
|
2717
3410
|
bg: baseBg,
|
|
2718
3411
|
border: renderColorValue(value.border, colorOptions),
|
|
2719
3412
|
button,
|
|
@@ -2724,8 +3417,16 @@ function renderThemeColor(value, options) {
|
|
|
2724
3417
|
fg: renderColorValue(value.fg, colorOptions),
|
|
2725
3418
|
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
2726
3419
|
icon: renderColorValue(value.icon, colorOptions),
|
|
2727
|
-
input: renderThemeColorInput(value.input, {
|
|
2728
|
-
|
|
3420
|
+
input: renderThemeColorInput(value.input, {
|
|
3421
|
+
baseBg,
|
|
3422
|
+
colorPalette,
|
|
3423
|
+
blendMode
|
|
3424
|
+
}),
|
|
3425
|
+
kbd: renderThemeColorKBD(value.kbd, {
|
|
3426
|
+
baseBg,
|
|
3427
|
+
colorPalette,
|
|
3428
|
+
blendMode
|
|
3429
|
+
}),
|
|
2729
3430
|
link: {
|
|
2730
3431
|
fg: renderColorValue(value.link.fg, colorOptions)
|
|
2731
3432
|
},
|
|
@@ -2738,12 +3439,20 @@ function renderThemeColor(value, options) {
|
|
|
2738
3439
|
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
2739
3440
|
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
2740
3441
|
},
|
|
2741
|
-
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3442
|
+
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3443
|
+
baseBg,
|
|
3444
|
+
colorPalette,
|
|
3445
|
+
blendMode
|
|
3446
|
+
}),
|
|
2742
3447
|
selectable
|
|
2743
3448
|
};
|
|
2744
3449
|
}
|
|
2745
3450
|
function renderThemeColorKBD(value, options) {
|
|
2746
|
-
const {
|
|
3451
|
+
const {
|
|
3452
|
+
baseBg,
|
|
3453
|
+
blendMode,
|
|
3454
|
+
colorPalette
|
|
3455
|
+
} = options, rootOptions = {
|
|
2747
3456
|
bg: baseBg,
|
|
2748
3457
|
blendMode,
|
|
2749
3458
|
colorPalette
|
|
@@ -2772,7 +3481,11 @@ function renderThemeColorAvatar(value, options) {
|
|
|
2772
3481
|
};
|
|
2773
3482
|
}
|
|
2774
3483
|
function renderThemeColorAvatarColor(value, options) {
|
|
2775
|
-
const {
|
|
3484
|
+
const {
|
|
3485
|
+
baseBg,
|
|
3486
|
+
blendMode: rootBlendMode,
|
|
3487
|
+
colorPalette
|
|
3488
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2776
3489
|
bg: baseBg,
|
|
2777
3490
|
blendMode: rootBlendMode,
|
|
2778
3491
|
colorPalette
|
|
@@ -2797,7 +3510,11 @@ function renderThemeColorBadge(value, options) {
|
|
|
2797
3510
|
};
|
|
2798
3511
|
}
|
|
2799
3512
|
function renderThemeColorBadgeColor(value, options) {
|
|
2800
|
-
const {
|
|
3513
|
+
const {
|
|
3514
|
+
baseBg,
|
|
3515
|
+
blendMode: rootBlendMode,
|
|
3516
|
+
colorPalette
|
|
3517
|
+
} = options, blendMode = rootBlendMode, rootOptions = {
|
|
2801
3518
|
bg: baseBg,
|
|
2802
3519
|
blendMode: rootBlendMode,
|
|
2803
3520
|
colorPalette
|
|
@@ -2839,7 +3556,11 @@ function renderThemeColorButtonStates(value, options) {
|
|
|
2839
3556
|
};
|
|
2840
3557
|
}
|
|
2841
3558
|
function renderThemeColorState(value, options) {
|
|
2842
|
-
const {
|
|
3559
|
+
const {
|
|
3560
|
+
baseBg,
|
|
3561
|
+
blendMode: rootBlendMode,
|
|
3562
|
+
colorPalette
|
|
3563
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2843
3564
|
bg: baseBg,
|
|
2844
3565
|
blendMode: rootBlendMode,
|
|
2845
3566
|
colorPalette
|
|
@@ -2853,8 +3574,16 @@ function renderThemeColorState(value, options) {
|
|
|
2853
3574
|
accent: {
|
|
2854
3575
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2855
3576
|
},
|
|
2856
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
2857
|
-
|
|
3577
|
+
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3578
|
+
baseBg: bg,
|
|
3579
|
+
colorPalette,
|
|
3580
|
+
blendMode
|
|
3581
|
+
}),
|
|
3582
|
+
badge: renderThemeColorBadge(value.badge, {
|
|
3583
|
+
baseBg: bg,
|
|
3584
|
+
colorPalette,
|
|
3585
|
+
blendMode
|
|
3586
|
+
}),
|
|
2858
3587
|
bg,
|
|
2859
3588
|
border: renderColorValue(value.border, colorOptions),
|
|
2860
3589
|
code: {
|
|
@@ -2896,7 +3625,19 @@ function renderInputStatesColorTheme(value, options) {
|
|
|
2896
3625
|
};
|
|
2897
3626
|
}
|
|
2898
3627
|
function renderInputStateColorTheme(value, options) {
|
|
2899
|
-
const {
|
|
3628
|
+
const {
|
|
3629
|
+
baseBg,
|
|
3630
|
+
blendMode: rootBlendMode,
|
|
3631
|
+
colorPalette
|
|
3632
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3633
|
+
colorPalette,
|
|
3634
|
+
bg: baseBg,
|
|
3635
|
+
blendMode: rootBlendMode
|
|
3636
|
+
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
3637
|
+
colorPalette,
|
|
3638
|
+
bg,
|
|
3639
|
+
blendMode
|
|
3640
|
+
};
|
|
2900
3641
|
return {
|
|
2901
3642
|
_blend: blendMode,
|
|
2902
3643
|
bg,
|
|
@@ -2927,7 +3668,15 @@ function renderThemeColorSelectableStates(value, options) {
|
|
|
2927
3668
|
};
|
|
2928
3669
|
}
|
|
2929
3670
|
function renderSyntaxColorTheme(value, options) {
|
|
2930
|
-
const {
|
|
3671
|
+
const {
|
|
3672
|
+
colorPalette,
|
|
3673
|
+
baseBg,
|
|
3674
|
+
blendMode
|
|
3675
|
+
} = options, colorOptions = {
|
|
3676
|
+
colorPalette,
|
|
3677
|
+
bg: baseBg,
|
|
3678
|
+
blendMode
|
|
3679
|
+
};
|
|
2931
3680
|
return {
|
|
2932
3681
|
atrule: renderColorValue(value.atrule, colorOptions),
|
|
2933
3682
|
attrName: renderColorValue(value.attrName, colorOptions),
|