@sanity/ui 2.8.14 → 2.8.15
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 +3133 -2916
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3235 -3018
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3133 -2916
- 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 +4 -4
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: {
|
|
@@ -2000,15 +2380,33 @@ function resolveBaseColorTones(inputTokens, tone) {
|
|
|
2000
2380
|
...spec,
|
|
2001
2381
|
_hue: hue,
|
|
2002
2382
|
avatar: {
|
|
2003
|
-
gray: merge({
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2383
|
+
gray: merge({
|
|
2384
|
+
_hue: "gray"
|
|
2385
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2386
|
+
blue: merge({
|
|
2387
|
+
_hue: "blue"
|
|
2388
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2389
|
+
purple: merge({
|
|
2390
|
+
_hue: "purple"
|
|
2391
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2392
|
+
magenta: merge({
|
|
2393
|
+
_hue: "magenta"
|
|
2394
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2395
|
+
red: merge({
|
|
2396
|
+
_hue: "red"
|
|
2397
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2398
|
+
orange: merge({
|
|
2399
|
+
_hue: "orange"
|
|
2400
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2401
|
+
yellow: merge({
|
|
2402
|
+
_hue: "yellow"
|
|
2403
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2404
|
+
green: merge({
|
|
2405
|
+
_hue: "green"
|
|
2406
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2407
|
+
cyan: merge({
|
|
2408
|
+
_hue: "cyan"
|
|
2409
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2012
2410
|
},
|
|
2013
2411
|
badge: {
|
|
2014
2412
|
default: {
|
|
@@ -2058,25 +2456,38 @@ function resolveButtonModeColorTokens(inputTokens, mode, tone) {
|
|
|
2058
2456
|
return tokens;
|
|
2059
2457
|
}
|
|
2060
2458
|
function resolveButtonStateColorTokens(inputTokens, tone, mode, state) {
|
|
2061
|
-
const spec = merge(
|
|
2062
|
-
inputTokens?.button?.[mode]?.["*"]?.["*"],
|
|
2063
|
-
inputTokens?.button?.[mode]?.[tone]?.["*"],
|
|
2064
|
-
inputTokens?.button?.[mode]?.["*"]?.[state],
|
|
2065
|
-
inputTokens?.button?.[mode]?.[tone]?.[state]
|
|
2066
|
-
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2459
|
+
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;
|
|
2067
2460
|
return {
|
|
2068
2461
|
...spec,
|
|
2069
2462
|
_hue: hue,
|
|
2070
2463
|
avatar: {
|
|
2071
|
-
gray: merge({
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2464
|
+
gray: merge({
|
|
2465
|
+
_hue: "gray"
|
|
2466
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2467
|
+
blue: merge({
|
|
2468
|
+
_hue: "blue"
|
|
2469
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2470
|
+
purple: merge({
|
|
2471
|
+
_hue: "purple"
|
|
2472
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2473
|
+
magenta: merge({
|
|
2474
|
+
_hue: "magenta"
|
|
2475
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2476
|
+
red: merge({
|
|
2477
|
+
_hue: "red"
|
|
2478
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2479
|
+
orange: merge({
|
|
2480
|
+
_hue: "orange"
|
|
2481
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2482
|
+
yellow: merge({
|
|
2483
|
+
_hue: "yellow"
|
|
2484
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2485
|
+
green: merge({
|
|
2486
|
+
_hue: "green"
|
|
2487
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2488
|
+
cyan: merge({
|
|
2489
|
+
_hue: "cyan"
|
|
2490
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2080
2491
|
},
|
|
2081
2492
|
badge: {
|
|
2082
2493
|
default: {
|
|
@@ -2120,13 +2531,11 @@ function resolveInputModeColorTokens(inputTokens, mode) {
|
|
|
2120
2531
|
return states;
|
|
2121
2532
|
}
|
|
2122
2533
|
function resolveInputStateColorTokens(inputTokens, mode, state) {
|
|
2123
|
-
const spec = merge(
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2129
|
-
return { ...spec, _hue: hue };
|
|
2534
|
+
const spec = merge(inputTokens?.input?.["*"]?.["*"], inputTokens?.input?.[mode]?.["*"], inputTokens?.input?.["*"]?.[state], inputTokens?.input?.[mode]?.[state]), hue = spec._hue || inputTokens?.input?.[mode]?._hue;
|
|
2535
|
+
return {
|
|
2536
|
+
...spec,
|
|
2537
|
+
_hue: hue
|
|
2538
|
+
};
|
|
2130
2539
|
}
|
|
2131
2540
|
function resolveSelectableColorTokens(inputTokens) {
|
|
2132
2541
|
const tokens = {};
|
|
@@ -2143,25 +2552,38 @@ function resolveSelectableToneColorTokens(inputTokens, tone) {
|
|
|
2143
2552
|
return states;
|
|
2144
2553
|
}
|
|
2145
2554
|
function resolveSelectableStateColorTokens(inputTokens, tone, state) {
|
|
2146
|
-
const spec = merge(
|
|
2147
|
-
inputTokens?.selectable?.["*"]?.["*"],
|
|
2148
|
-
inputTokens?.selectable?.[tone]?.["*"],
|
|
2149
|
-
inputTokens?.selectable?.["*"]?.[state],
|
|
2150
|
-
inputTokens?.selectable?.[tone]?.[state]
|
|
2151
|
-
), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2555
|
+
const spec = merge(inputTokens?.selectable?.["*"]?.["*"], inputTokens?.selectable?.[tone]?.["*"], inputTokens?.selectable?.["*"]?.[state], inputTokens?.selectable?.[tone]?.[state]), hue = spec._hue || inputTokens?.base?.[tone]?._hue;
|
|
2152
2556
|
return {
|
|
2153
2557
|
...spec,
|
|
2154
2558
|
_hue: hue,
|
|
2155
2559
|
avatar: {
|
|
2156
|
-
gray: merge({
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2560
|
+
gray: merge({
|
|
2561
|
+
_hue: "gray"
|
|
2562
|
+
}, spec.avatar?.["*"], spec.avatar?.gray),
|
|
2563
|
+
blue: merge({
|
|
2564
|
+
_hue: "blue"
|
|
2565
|
+
}, spec.avatar?.["*"], spec.avatar?.blue),
|
|
2566
|
+
purple: merge({
|
|
2567
|
+
_hue: "purple"
|
|
2568
|
+
}, spec.avatar?.["*"], spec.avatar?.purple),
|
|
2569
|
+
magenta: merge({
|
|
2570
|
+
_hue: "magenta"
|
|
2571
|
+
}, spec.avatar?.["*"], spec.avatar?.magenta),
|
|
2572
|
+
red: merge({
|
|
2573
|
+
_hue: "red"
|
|
2574
|
+
}, spec.avatar?.["*"], spec.avatar?.red),
|
|
2575
|
+
orange: merge({
|
|
2576
|
+
_hue: "orange"
|
|
2577
|
+
}, spec.avatar?.["*"], spec.avatar?.orange),
|
|
2578
|
+
yellow: merge({
|
|
2579
|
+
_hue: "yellow"
|
|
2580
|
+
}, spec.avatar?.["*"], spec.avatar?.yellow),
|
|
2581
|
+
green: merge({
|
|
2582
|
+
_hue: "green"
|
|
2583
|
+
}, spec.avatar?.["*"], spec.avatar?.green),
|
|
2584
|
+
cyan: merge({
|
|
2585
|
+
_hue: "cyan"
|
|
2586
|
+
}, spec.avatar?.["*"], spec.avatar?.cyan)
|
|
2165
2587
|
},
|
|
2166
2588
|
badge: {
|
|
2167
2589
|
default: {
|
|
@@ -2198,35 +2620,71 @@ function buildColorTheme(config) {
|
|
|
2198
2620
|
color: resolveColorTokens(config?.color)
|
|
2199
2621
|
};
|
|
2200
2622
|
return {
|
|
2201
|
-
light: buildColorScheme({
|
|
2202
|
-
|
|
2623
|
+
light: buildColorScheme({
|
|
2624
|
+
scheme: "light"
|
|
2625
|
+
}, resolvedConfig),
|
|
2626
|
+
dark: buildColorScheme({
|
|
2627
|
+
scheme: "dark"
|
|
2628
|
+
}, resolvedConfig)
|
|
2203
2629
|
};
|
|
2204
2630
|
}
|
|
2205
2631
|
function buildColorScheme(options, config) {
|
|
2206
|
-
const {
|
|
2632
|
+
const {
|
|
2633
|
+
scheme
|
|
2634
|
+
} = options;
|
|
2207
2635
|
return {
|
|
2208
|
-
transparent: buildCardColorTheme({
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2636
|
+
transparent: buildCardColorTheme({
|
|
2637
|
+
scheme,
|
|
2638
|
+
tone: "transparent"
|
|
2639
|
+
}, config),
|
|
2640
|
+
default: buildCardColorTheme({
|
|
2641
|
+
scheme,
|
|
2642
|
+
tone: "default"
|
|
2643
|
+
}, config),
|
|
2644
|
+
primary: buildCardColorTheme({
|
|
2645
|
+
scheme,
|
|
2646
|
+
tone: "primary"
|
|
2647
|
+
}, config),
|
|
2648
|
+
positive: buildCardColorTheme({
|
|
2649
|
+
scheme,
|
|
2650
|
+
tone: "positive"
|
|
2651
|
+
}, config),
|
|
2652
|
+
caution: buildCardColorTheme({
|
|
2653
|
+
scheme,
|
|
2654
|
+
tone: "caution"
|
|
2655
|
+
}, config),
|
|
2656
|
+
critical: buildCardColorTheme({
|
|
2657
|
+
scheme,
|
|
2658
|
+
tone: "critical"
|
|
2659
|
+
}, config)
|
|
2214
2660
|
};
|
|
2215
2661
|
}
|
|
2216
2662
|
function buildCardColorTheme(options, config) {
|
|
2217
|
-
const {
|
|
2663
|
+
const {
|
|
2664
|
+
scheme,
|
|
2665
|
+
tone
|
|
2666
|
+
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
2667
|
+
hue: tokens?._hue || "gray",
|
|
2668
|
+
scheme
|
|
2669
|
+
};
|
|
2218
2670
|
return {
|
|
2219
2671
|
_blend: (tokens?._blend || ["multiply", "screen"])[scheme === "light" ? 0 : 1],
|
|
2220
2672
|
_dark: scheme === "dark",
|
|
2221
2673
|
accent: {
|
|
2222
2674
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2223
2675
|
},
|
|
2224
|
-
avatar: buildAvatarColorTheme({
|
|
2676
|
+
avatar: buildAvatarColorTheme({
|
|
2677
|
+
scheme
|
|
2678
|
+
}, tokens),
|
|
2225
2679
|
backdrop: resolveColorTokenValue(context, tokens?.backdrop),
|
|
2226
|
-
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2680
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2681
|
+
scheme
|
|
2682
|
+
}, config),
|
|
2227
2683
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2228
2684
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2229
|
-
button: buildButtonColorTheme({
|
|
2685
|
+
button: buildButtonColorTheme({
|
|
2686
|
+
scheme
|
|
2687
|
+
}, config),
|
|
2230
2688
|
code: {
|
|
2231
2689
|
bg: resolveColorTokenValue(context, tokens?.code?.bg),
|
|
2232
2690
|
fg: resolveColorTokenValue(context, tokens?.code?.fg)
|
|
@@ -2234,7 +2692,10 @@ function buildCardColorTheme(options, config) {
|
|
|
2234
2692
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
2235
2693
|
focusRing: resolveColorTokenValue(context, tokens?.focusRing),
|
|
2236
2694
|
icon: resolveColorTokenValue(context, tokens?.icon),
|
|
2237
|
-
input: buildInputColorTheme({
|
|
2695
|
+
input: buildInputColorTheme({
|
|
2696
|
+
scheme,
|
|
2697
|
+
tone
|
|
2698
|
+
}, config),
|
|
2238
2699
|
kbd: {
|
|
2239
2700
|
bg: resolveColorTokenValue(context, tokens?.kbd?.bg),
|
|
2240
2701
|
fg: resolveColorTokenValue(context, tokens?.kbd?.fg),
|
|
@@ -2247,17 +2708,30 @@ function buildCardColorTheme(options, config) {
|
|
|
2247
2708
|
bg: resolveColorTokenValue(context, tokens?.muted?.bg),
|
|
2248
2709
|
fg: resolveColorTokenValue(context, tokens?.muted?.fg)
|
|
2249
2710
|
},
|
|
2250
|
-
selectable: buildSelectableColorTheme({
|
|
2251
|
-
|
|
2711
|
+
selectable: buildSelectableColorTheme({
|
|
2712
|
+
scheme
|
|
2713
|
+
}, config),
|
|
2714
|
+
shadow: buildShadowColorTheme({
|
|
2715
|
+
scheme,
|
|
2716
|
+
tone
|
|
2717
|
+
}, config),
|
|
2252
2718
|
skeleton: {
|
|
2253
2719
|
from: resolveColorTokenValue(context, tokens?.skeleton?.from),
|
|
2254
2720
|
to: resolveColorTokenValue(context, tokens?.skeleton?.to)
|
|
2255
2721
|
},
|
|
2256
|
-
syntax: buildSyntaxColorTheme({
|
|
2722
|
+
syntax: buildSyntaxColorTheme({
|
|
2723
|
+
scheme
|
|
2724
|
+
}, config)
|
|
2257
2725
|
};
|
|
2258
2726
|
}
|
|
2259
2727
|
function buildShadowColorTheme(options, config) {
|
|
2260
|
-
const {
|
|
2728
|
+
const {
|
|
2729
|
+
scheme,
|
|
2730
|
+
tone
|
|
2731
|
+
} = options, tokens = config?.color?.base?.[tone], context = {
|
|
2732
|
+
hue: tokens?._hue || "gray",
|
|
2733
|
+
scheme
|
|
2734
|
+
};
|
|
2261
2735
|
return {
|
|
2262
2736
|
outline: resolveColorTokenValue(context, tokens?.shadow?.outline),
|
|
2263
2737
|
umbra: resolveColorTokenValue(context, tokens?.shadow?.umbra),
|
|
@@ -2266,21 +2740,56 @@ function buildShadowColorTheme(options, config) {
|
|
|
2266
2740
|
};
|
|
2267
2741
|
}
|
|
2268
2742
|
function buildAvatarColorTheme(options, stateTokens) {
|
|
2269
|
-
const {
|
|
2743
|
+
const {
|
|
2744
|
+
scheme
|
|
2745
|
+
} = options;
|
|
2270
2746
|
return {
|
|
2271
|
-
gray: _buildAvatarColorTheme({
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2747
|
+
gray: _buildAvatarColorTheme({
|
|
2748
|
+
color: "gray",
|
|
2749
|
+
scheme
|
|
2750
|
+
}, stateTokens),
|
|
2751
|
+
blue: _buildAvatarColorTheme({
|
|
2752
|
+
color: "blue",
|
|
2753
|
+
scheme
|
|
2754
|
+
}, stateTokens),
|
|
2755
|
+
purple: _buildAvatarColorTheme({
|
|
2756
|
+
color: "purple",
|
|
2757
|
+
scheme
|
|
2758
|
+
}, stateTokens),
|
|
2759
|
+
magenta: _buildAvatarColorTheme({
|
|
2760
|
+
color: "magenta",
|
|
2761
|
+
scheme
|
|
2762
|
+
}, stateTokens),
|
|
2763
|
+
red: _buildAvatarColorTheme({
|
|
2764
|
+
color: "red",
|
|
2765
|
+
scheme
|
|
2766
|
+
}, stateTokens),
|
|
2767
|
+
orange: _buildAvatarColorTheme({
|
|
2768
|
+
color: "orange",
|
|
2769
|
+
scheme
|
|
2770
|
+
}, stateTokens),
|
|
2771
|
+
yellow: _buildAvatarColorTheme({
|
|
2772
|
+
color: "yellow",
|
|
2773
|
+
scheme
|
|
2774
|
+
}, stateTokens),
|
|
2775
|
+
green: _buildAvatarColorTheme({
|
|
2776
|
+
color: "green",
|
|
2777
|
+
scheme
|
|
2778
|
+
}, stateTokens),
|
|
2779
|
+
cyan: _buildAvatarColorTheme({
|
|
2780
|
+
color: "cyan",
|
|
2781
|
+
scheme
|
|
2782
|
+
}, stateTokens)
|
|
2280
2783
|
};
|
|
2281
2784
|
}
|
|
2282
2785
|
function _buildAvatarColorTheme(options, stateTokens) {
|
|
2283
|
-
const {
|
|
2786
|
+
const {
|
|
2787
|
+
color: color2,
|
|
2788
|
+
scheme
|
|
2789
|
+
} = options, tokens = stateTokens?.avatar?.[color2], context = {
|
|
2790
|
+
hue: tokens?._hue || "gray",
|
|
2791
|
+
scheme
|
|
2792
|
+
};
|
|
2284
2793
|
return {
|
|
2285
2794
|
_blend: (tokens?._blend || ["screen", "multiply"])[scheme === "light" ? 0 : 1],
|
|
2286
2795
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2288,17 +2797,40 @@ function _buildAvatarColorTheme(options, stateTokens) {
|
|
|
2288
2797
|
};
|
|
2289
2798
|
}
|
|
2290
2799
|
function buildBadgeColorTheme(tokens, options, config) {
|
|
2291
|
-
const {
|
|
2800
|
+
const {
|
|
2801
|
+
scheme
|
|
2802
|
+
} = options;
|
|
2292
2803
|
return {
|
|
2293
|
-
default: _buildBadgeColorTheme(tokens, {
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2804
|
+
default: _buildBadgeColorTheme(tokens, {
|
|
2805
|
+
scheme,
|
|
2806
|
+
tone: "default"
|
|
2807
|
+
}, config),
|
|
2808
|
+
primary: _buildBadgeColorTheme(tokens, {
|
|
2809
|
+
scheme,
|
|
2810
|
+
tone: "primary"
|
|
2811
|
+
}, config),
|
|
2812
|
+
positive: _buildBadgeColorTheme(tokens, {
|
|
2813
|
+
scheme,
|
|
2814
|
+
tone: "positive"
|
|
2815
|
+
}, config),
|
|
2816
|
+
caution: _buildBadgeColorTheme(tokens, {
|
|
2817
|
+
scheme,
|
|
2818
|
+
tone: "caution"
|
|
2819
|
+
}, config),
|
|
2820
|
+
critical: _buildBadgeColorTheme(tokens, {
|
|
2821
|
+
scheme,
|
|
2822
|
+
tone: "critical"
|
|
2823
|
+
}, config)
|
|
2298
2824
|
};
|
|
2299
2825
|
}
|
|
2300
2826
|
function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
2301
|
-
const {
|
|
2827
|
+
const {
|
|
2828
|
+
scheme,
|
|
2829
|
+
tone
|
|
2830
|
+
} = options, tokens = parentTokens?.[tone], context = {
|
|
2831
|
+
hue: tokens?._hue || config?.color?.base?.[tone]?._hue || "gray",
|
|
2832
|
+
scheme
|
|
2833
|
+
};
|
|
2302
2834
|
return {
|
|
2303
2835
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2304
2836
|
fg: resolveColorTokenValue(context, tokens?.fg),
|
|
@@ -2307,32 +2839,65 @@ function _buildBadgeColorTheme(parentTokens, options, config) {
|
|
|
2307
2839
|
};
|
|
2308
2840
|
}
|
|
2309
2841
|
function buildButtonColorTheme(options, config) {
|
|
2310
|
-
const {
|
|
2842
|
+
const {
|
|
2843
|
+
scheme
|
|
2844
|
+
} = options, modes = {};
|
|
2311
2845
|
for (const mode of THEME_COLOR_BUTTON_MODES)
|
|
2312
|
-
modes[mode] = buildButtonTonesColorTheme({
|
|
2846
|
+
modes[mode] = buildButtonTonesColorTheme({
|
|
2847
|
+
scheme,
|
|
2848
|
+
mode
|
|
2849
|
+
}, config);
|
|
2313
2850
|
return modes;
|
|
2314
2851
|
}
|
|
2315
2852
|
function buildButtonTonesColorTheme(options, config) {
|
|
2316
|
-
const {
|
|
2853
|
+
const {
|
|
2854
|
+
mode,
|
|
2855
|
+
scheme
|
|
2856
|
+
} = options, tones2 = {};
|
|
2317
2857
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2318
|
-
tones2[tone] = buildButtonStatesColorTheme({
|
|
2858
|
+
tones2[tone] = buildButtonStatesColorTheme({
|
|
2859
|
+
mode,
|
|
2860
|
+
scheme,
|
|
2861
|
+
tone
|
|
2862
|
+
}, config);
|
|
2319
2863
|
return tones2;
|
|
2320
2864
|
}
|
|
2321
2865
|
function buildButtonStatesColorTheme(options, config) {
|
|
2322
|
-
const {
|
|
2866
|
+
const {
|
|
2867
|
+
mode,
|
|
2868
|
+
scheme,
|
|
2869
|
+
tone
|
|
2870
|
+
} = options, states = {};
|
|
2323
2871
|
for (const state of THEME_COLOR_STATES)
|
|
2324
|
-
states[state] = buildButtonStateColorTheme({
|
|
2872
|
+
states[state] = buildButtonStateColorTheme({
|
|
2873
|
+
mode,
|
|
2874
|
+
tone,
|
|
2875
|
+
scheme,
|
|
2876
|
+
state
|
|
2877
|
+
}, config);
|
|
2325
2878
|
return states;
|
|
2326
2879
|
}
|
|
2327
2880
|
function buildButtonStateColorTheme(options, config) {
|
|
2328
|
-
const {
|
|
2881
|
+
const {
|
|
2882
|
+
mode,
|
|
2883
|
+
tone,
|
|
2884
|
+
scheme,
|
|
2885
|
+
state
|
|
2886
|
+
} = options, tokens = config?.color?.button?.[mode]?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2887
|
+
hue,
|
|
2888
|
+
scheme
|
|
2889
|
+
};
|
|
2329
2890
|
return {
|
|
2330
2891
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2331
2892
|
accent: {
|
|
2332
2893
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2333
2894
|
},
|
|
2334
|
-
avatar: buildAvatarColorTheme({
|
|
2335
|
-
|
|
2895
|
+
avatar: buildAvatarColorTheme({
|
|
2896
|
+
scheme
|
|
2897
|
+
}, tokens),
|
|
2898
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
2899
|
+
scheme
|
|
2900
|
+
}, config),
|
|
2336
2901
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2337
2902
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2338
2903
|
code: {
|
|
@@ -2360,23 +2925,66 @@ function buildButtonStateColorTheme(options, config) {
|
|
|
2360
2925
|
};
|
|
2361
2926
|
}
|
|
2362
2927
|
function buildInputColorTheme(options, config) {
|
|
2363
|
-
const {
|
|
2928
|
+
const {
|
|
2929
|
+
scheme,
|
|
2930
|
+
tone
|
|
2931
|
+
} = options;
|
|
2364
2932
|
return {
|
|
2365
|
-
default: buildInputStatesColorTheme({
|
|
2366
|
-
|
|
2933
|
+
default: buildInputStatesColorTheme({
|
|
2934
|
+
mode: "default",
|
|
2935
|
+
scheme,
|
|
2936
|
+
tone
|
|
2937
|
+
}, config),
|
|
2938
|
+
invalid: buildInputStatesColorTheme({
|
|
2939
|
+
mode: "invalid",
|
|
2940
|
+
scheme,
|
|
2941
|
+
tone
|
|
2942
|
+
}, config)
|
|
2367
2943
|
};
|
|
2368
2944
|
}
|
|
2369
2945
|
function buildInputStatesColorTheme(options, config) {
|
|
2370
|
-
const {
|
|
2946
|
+
const {
|
|
2947
|
+
mode,
|
|
2948
|
+
scheme,
|
|
2949
|
+
tone
|
|
2950
|
+
} = options;
|
|
2371
2951
|
return {
|
|
2372
|
-
enabled: buildInputStateColorTheme({
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2952
|
+
enabled: buildInputStateColorTheme({
|
|
2953
|
+
mode,
|
|
2954
|
+
scheme,
|
|
2955
|
+
state: "enabled",
|
|
2956
|
+
tone
|
|
2957
|
+
}, config),
|
|
2958
|
+
hovered: buildInputStateColorTheme({
|
|
2959
|
+
mode,
|
|
2960
|
+
scheme,
|
|
2961
|
+
state: "hovered",
|
|
2962
|
+
tone
|
|
2963
|
+
}, config),
|
|
2964
|
+
readOnly: buildInputStateColorTheme({
|
|
2965
|
+
mode,
|
|
2966
|
+
scheme,
|
|
2967
|
+
state: "readOnly",
|
|
2968
|
+
tone
|
|
2969
|
+
}, config),
|
|
2970
|
+
disabled: buildInputStateColorTheme({
|
|
2971
|
+
mode,
|
|
2972
|
+
scheme,
|
|
2973
|
+
state: "disabled",
|
|
2974
|
+
tone
|
|
2975
|
+
}, config)
|
|
2376
2976
|
};
|
|
2377
2977
|
}
|
|
2378
2978
|
function buildInputStateColorTheme(options, config) {
|
|
2379
|
-
const {
|
|
2979
|
+
const {
|
|
2980
|
+
mode,
|
|
2981
|
+
tone,
|
|
2982
|
+
scheme,
|
|
2983
|
+
state
|
|
2984
|
+
} = options, tokens = config?.color?.input?.[mode]?.[state], hue = tokens?._hue || config?.color?.base?.[tone]?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
2985
|
+
hue,
|
|
2986
|
+
scheme
|
|
2987
|
+
};
|
|
2380
2988
|
return {
|
|
2381
2989
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2382
2990
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
@@ -2389,26 +2997,49 @@ function buildInputStateColorTheme(options, config) {
|
|
|
2389
2997
|
};
|
|
2390
2998
|
}
|
|
2391
2999
|
function buildSelectableColorTheme(options, config) {
|
|
2392
|
-
const {
|
|
3000
|
+
const {
|
|
3001
|
+
scheme
|
|
3002
|
+
} = options, tones2 = {};
|
|
2393
3003
|
for (const tone of THEME_COLOR_STATE_TONES)
|
|
2394
|
-
tones2[tone] = buildSelectableStatesColorTheme({
|
|
3004
|
+
tones2[tone] = buildSelectableStatesColorTheme({
|
|
3005
|
+
scheme,
|
|
3006
|
+
tone
|
|
3007
|
+
}, config);
|
|
2395
3008
|
return tones2;
|
|
2396
3009
|
}
|
|
2397
3010
|
function buildSelectableStatesColorTheme(options, config) {
|
|
2398
|
-
const {
|
|
3011
|
+
const {
|
|
3012
|
+
scheme,
|
|
3013
|
+
tone
|
|
3014
|
+
} = options, states = {};
|
|
2399
3015
|
for (const state of THEME_COLOR_STATES)
|
|
2400
|
-
states[state] = buildSelectableStateColorTheme({
|
|
3016
|
+
states[state] = buildSelectableStateColorTheme({
|
|
3017
|
+
tone,
|
|
3018
|
+
scheme,
|
|
3019
|
+
state
|
|
3020
|
+
}, config);
|
|
2401
3021
|
return states;
|
|
2402
3022
|
}
|
|
2403
3023
|
function buildSelectableStateColorTheme(options, config) {
|
|
2404
|
-
const {
|
|
3024
|
+
const {
|
|
3025
|
+
scheme,
|
|
3026
|
+
state,
|
|
3027
|
+
tone
|
|
3028
|
+
} = options, tokens = config?.color?.selectable?.[tone]?.[state], hue = tokens?._hue || "gray", blendMode = tokens?._blend || ["screen", "multiply"], context = {
|
|
3029
|
+
hue,
|
|
3030
|
+
scheme
|
|
3031
|
+
};
|
|
2405
3032
|
return {
|
|
2406
3033
|
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
2407
3034
|
accent: {
|
|
2408
3035
|
fg: resolveColorTokenValue(context, tokens?.accent?.fg)
|
|
2409
3036
|
},
|
|
2410
|
-
avatar: buildAvatarColorTheme({
|
|
2411
|
-
|
|
3037
|
+
avatar: buildAvatarColorTheme({
|
|
3038
|
+
scheme
|
|
3039
|
+
}, tokens),
|
|
3040
|
+
badge: buildBadgeColorTheme(tokens?.badge, {
|
|
3041
|
+
scheme
|
|
3042
|
+
}, config),
|
|
2412
3043
|
bg: resolveColorTokenValue(context, tokens?.bg),
|
|
2413
3044
|
border: resolveColorTokenValue(context, tokens?.border),
|
|
2414
3045
|
code: {
|
|
@@ -2436,7 +3067,12 @@ function buildSelectableStateColorTheme(options, config) {
|
|
|
2436
3067
|
};
|
|
2437
3068
|
}
|
|
2438
3069
|
function buildSyntaxColorTheme(options, config) {
|
|
2439
|
-
const {
|
|
3070
|
+
const {
|
|
3071
|
+
scheme
|
|
3072
|
+
} = options, tokens = config?.color?.syntax, context = {
|
|
3073
|
+
hue: "gray",
|
|
3074
|
+
scheme
|
|
3075
|
+
};
|
|
2440
3076
|
return {
|
|
2441
3077
|
atrule: resolveColorTokenValue(context, tokens?.atrule),
|
|
2442
3078
|
attrName: resolveColorTokenValue(context, tokens?.attrName),
|
|
@@ -2551,11 +3187,19 @@ function rgbToHex(color2) {
|
|
|
2551
3187
|
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));
|
|
2552
3188
|
return "a" in color2 ? `rgba(${r},${g},${b},${color2.a})` : "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
2553
3189
|
}
|
|
2554
|
-
function rgbToHsl({
|
|
3190
|
+
function rgbToHsl({
|
|
3191
|
+
r,
|
|
3192
|
+
g,
|
|
3193
|
+
b
|
|
3194
|
+
}) {
|
|
2555
3195
|
r /= 255, g /= 255, b /= 255;
|
|
2556
3196
|
const cmin = Math.min(r, g, b), cmax = Math.max(r, g, b), delta = cmax - cmin;
|
|
2557
3197
|
let h = 0, s = 0, l = 0;
|
|
2558
|
-
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
|
+
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), {
|
|
3199
|
+
h,
|
|
3200
|
+
s,
|
|
3201
|
+
l
|
|
3202
|
+
};
|
|
2559
3203
|
}
|
|
2560
3204
|
function hslToRgb(hsl) {
|
|
2561
3205
|
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;
|
|
@@ -2580,10 +3224,18 @@ function parseHsl(str) {
|
|
|
2580
3224
|
const res = HSL_RE.exec(str);
|
|
2581
3225
|
if (!res)
|
|
2582
3226
|
throw new Error(`parseHsl: string is not a HSL color: "${str}"`);
|
|
2583
|
-
return {
|
|
3227
|
+
return {
|
|
3228
|
+
h: parseInt(res[1]),
|
|
3229
|
+
s: parseFloat(res[3]),
|
|
3230
|
+
l: parseFloat(res[5])
|
|
3231
|
+
};
|
|
2584
3232
|
}
|
|
2585
3233
|
function parseColor(color2) {
|
|
2586
|
-
if (!color2) return {
|
|
3234
|
+
if (!color2) return {
|
|
3235
|
+
r: 0,
|
|
3236
|
+
g: 0,
|
|
3237
|
+
b: 0
|
|
3238
|
+
};
|
|
2587
3239
|
if (typeof color2 != "string")
|
|
2588
3240
|
throw new Error("parseColor: expected a string");
|
|
2589
3241
|
if (isHex(color2))
|
|
@@ -2598,7 +3250,11 @@ function getContrastRatio(bg, fg) {
|
|
|
2598
3250
|
const rgb1 = parseColor(bg), rgb2 = parseColor(fg), c1 = rgb_lrgb(rgb1), c2 = rgb_lrgb(rgb2), l1 = lrgb_luminance(c1), l2 = lrgb_luminance(c2);
|
|
2599
3251
|
return (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
2600
3252
|
}
|
|
2601
|
-
function rgb_lrgb({
|
|
3253
|
+
function rgb_lrgb({
|
|
3254
|
+
r,
|
|
3255
|
+
g,
|
|
3256
|
+
b
|
|
3257
|
+
}) {
|
|
2602
3258
|
return [rgb_lrgb1(r / 255), rgb_lrgb1(g / 255), rgb_lrgb1(b / 255)];
|
|
2603
3259
|
}
|
|
2604
3260
|
function rgb_lrgb1(v) {
|
|
@@ -2613,7 +3269,9 @@ function rgba(color2, a) {
|
|
|
2613
3269
|
}
|
|
2614
3270
|
const RGB_RANGE = [0, 255];
|
|
2615
3271
|
function mixThemeColor(value, options) {
|
|
2616
|
-
const {
|
|
3272
|
+
const {
|
|
3273
|
+
blendMode
|
|
3274
|
+
} = options, color2 = parseColor(value), black2 = parseColor(options.black), white2 = parseColor(options.white), bg = options.bg ? parseColor(options.bg) : blendMode === "multiply" ? white2 : black2, paletteRange = {
|
|
2617
3275
|
r: [black2.r, white2.r],
|
|
2618
3276
|
g: [black2.g, white2.g],
|
|
2619
3277
|
b: [black2.b, white2.b]
|
|
@@ -2633,7 +3291,11 @@ function mixThemeColor(value, options) {
|
|
|
2633
3291
|
return rgbToHex(v);
|
|
2634
3292
|
}
|
|
2635
3293
|
function renderColorValue(str, options) {
|
|
2636
|
-
const {
|
|
3294
|
+
const {
|
|
3295
|
+
bg,
|
|
3296
|
+
blendMode,
|
|
3297
|
+
colorPalette
|
|
3298
|
+
} = options;
|
|
2637
3299
|
if (bg === "white")
|
|
2638
3300
|
throw new Error("Cannot blend with white background");
|
|
2639
3301
|
const node = parseTokenValue(str);
|
|
@@ -2670,17 +3332,31 @@ function renderThemeColorSchemes(value, config) {
|
|
|
2670
3332
|
};
|
|
2671
3333
|
}
|
|
2672
3334
|
function renderThemeColorScheme(colorPalette, value) {
|
|
2673
|
-
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3335
|
+
const toneEntries = Object.entries(value), [, transparentTone] = toneEntries.find(([k]) => k === "transparent"), [, defaultTone] = toneEntries.find(([k]) => k === "default"), renderedTransparentTone = renderThemeColor(transparentTone, {
|
|
3336
|
+
colorPalette
|
|
3337
|
+
}), renderedDefaultTone = renderThemeColor(defaultTone, {
|
|
3338
|
+
colorPalette
|
|
3339
|
+
}), bg = renderedDefaultTone.bg;
|
|
2674
3340
|
if (bg === "white")
|
|
2675
3341
|
throw new Error("Cannot blend with white background");
|
|
2676
|
-
return Object.fromEntries([
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
]);
|
|
3342
|
+
return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(([k]) => k !== "default" && k !== "transparent").map(([k, v]) => [k, renderThemeColor(v, {
|
|
3343
|
+
bg,
|
|
3344
|
+
colorPalette
|
|
3345
|
+
})])]);
|
|
2681
3346
|
}
|
|
2682
3347
|
function renderThemeColor(value, options) {
|
|
2683
|
-
const {
|
|
3348
|
+
const {
|
|
3349
|
+
colorPalette,
|
|
3350
|
+
bg
|
|
3351
|
+
} = options, blendMode = value._blend || "multiply", baseBg = renderColorValue(value.bg, {
|
|
3352
|
+
colorPalette,
|
|
3353
|
+
bg,
|
|
3354
|
+
blendMode
|
|
3355
|
+
}), colorOptions = {
|
|
3356
|
+
colorPalette,
|
|
3357
|
+
bg: baseBg,
|
|
3358
|
+
blendMode
|
|
3359
|
+
}, button = renderThemeColorButton(value.button, {
|
|
2684
3360
|
baseBg,
|
|
2685
3361
|
blendMode,
|
|
2686
3362
|
colorPalette
|
|
@@ -2693,17 +3369,26 @@ function renderThemeColor(value, options) {
|
|
|
2693
3369
|
umbra: renderColorValue(value.shadow.umbra, {
|
|
2694
3370
|
...colorOptions,
|
|
2695
3371
|
bg: void 0,
|
|
2696
|
-
colorPalette: {
|
|
3372
|
+
colorPalette: {
|
|
3373
|
+
...colorPalette,
|
|
3374
|
+
black: "#000000"
|
|
3375
|
+
}
|
|
2697
3376
|
}),
|
|
2698
3377
|
penumbra: renderColorValue(value.shadow.penumbra, {
|
|
2699
3378
|
...colorOptions,
|
|
2700
3379
|
bg: void 0,
|
|
2701
|
-
colorPalette: {
|
|
3380
|
+
colorPalette: {
|
|
3381
|
+
...colorPalette,
|
|
3382
|
+
black: "#000000"
|
|
3383
|
+
}
|
|
2702
3384
|
}),
|
|
2703
3385
|
ambient: renderColorValue(value.shadow.ambient, {
|
|
2704
3386
|
...colorOptions,
|
|
2705
3387
|
bg: void 0,
|
|
2706
|
-
colorPalette: {
|
|
3388
|
+
colorPalette: {
|
|
3389
|
+
...colorPalette,
|
|
3390
|
+
black: "#000000"
|
|
3391
|
+
}
|
|
2707
3392
|
})
|
|
2708
3393
|
};
|
|
2709
3394
|
return {
|
|
@@ -2712,9 +3397,17 @@ function renderThemeColor(value, options) {
|
|
|
2712
3397
|
accent: {
|
|
2713
3398
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2714
3399
|
},
|
|
2715
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3400
|
+
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3401
|
+
baseBg,
|
|
3402
|
+
colorPalette,
|
|
3403
|
+
blendMode
|
|
3404
|
+
}),
|
|
2716
3405
|
backdrop: renderColorValue(value.backdrop, colorOptions),
|
|
2717
|
-
badge: renderThemeColorBadge(value.badge, {
|
|
3406
|
+
badge: renderThemeColorBadge(value.badge, {
|
|
3407
|
+
baseBg,
|
|
3408
|
+
colorPalette,
|
|
3409
|
+
blendMode
|
|
3410
|
+
}),
|
|
2718
3411
|
bg: baseBg,
|
|
2719
3412
|
border: renderColorValue(value.border, colorOptions),
|
|
2720
3413
|
button,
|
|
@@ -2725,8 +3418,16 @@ function renderThemeColor(value, options) {
|
|
|
2725
3418
|
fg: renderColorValue(value.fg, colorOptions),
|
|
2726
3419
|
focusRing: renderColorValue(value.focusRing, colorOptions),
|
|
2727
3420
|
icon: renderColorValue(value.icon, colorOptions),
|
|
2728
|
-
input: renderThemeColorInput(value.input, {
|
|
2729
|
-
|
|
3421
|
+
input: renderThemeColorInput(value.input, {
|
|
3422
|
+
baseBg,
|
|
3423
|
+
colorPalette,
|
|
3424
|
+
blendMode
|
|
3425
|
+
}),
|
|
3426
|
+
kbd: renderThemeColorKBD(value.kbd, {
|
|
3427
|
+
baseBg,
|
|
3428
|
+
colorPalette,
|
|
3429
|
+
blendMode
|
|
3430
|
+
}),
|
|
2730
3431
|
link: {
|
|
2731
3432
|
fg: renderColorValue(value.link.fg, colorOptions)
|
|
2732
3433
|
},
|
|
@@ -2739,12 +3440,20 @@ function renderThemeColor(value, options) {
|
|
|
2739
3440
|
from: renderColorValue(value.skeleton.from, colorOptions),
|
|
2740
3441
|
to: renderColorValue(value.skeleton.to, colorOptions)
|
|
2741
3442
|
},
|
|
2742
|
-
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3443
|
+
syntax: renderSyntaxColorTheme(value.syntax, {
|
|
3444
|
+
baseBg,
|
|
3445
|
+
colorPalette,
|
|
3446
|
+
blendMode
|
|
3447
|
+
}),
|
|
2743
3448
|
selectable
|
|
2744
3449
|
};
|
|
2745
3450
|
}
|
|
2746
3451
|
function renderThemeColorKBD(value, options) {
|
|
2747
|
-
const {
|
|
3452
|
+
const {
|
|
3453
|
+
baseBg,
|
|
3454
|
+
blendMode,
|
|
3455
|
+
colorPalette
|
|
3456
|
+
} = options, rootOptions = {
|
|
2748
3457
|
bg: baseBg,
|
|
2749
3458
|
blendMode,
|
|
2750
3459
|
colorPalette
|
|
@@ -2773,7 +3482,11 @@ function renderThemeColorAvatar(value, options) {
|
|
|
2773
3482
|
};
|
|
2774
3483
|
}
|
|
2775
3484
|
function renderThemeColorAvatarColor(value, options) {
|
|
2776
|
-
const {
|
|
3485
|
+
const {
|
|
3486
|
+
baseBg,
|
|
3487
|
+
blendMode: rootBlendMode,
|
|
3488
|
+
colorPalette
|
|
3489
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2777
3490
|
bg: baseBg,
|
|
2778
3491
|
blendMode: rootBlendMode,
|
|
2779
3492
|
colorPalette
|
|
@@ -2798,7 +3511,11 @@ function renderThemeColorBadge(value, options) {
|
|
|
2798
3511
|
};
|
|
2799
3512
|
}
|
|
2800
3513
|
function renderThemeColorBadgeColor(value, options) {
|
|
2801
|
-
const {
|
|
3514
|
+
const {
|
|
3515
|
+
baseBg,
|
|
3516
|
+
blendMode: rootBlendMode,
|
|
3517
|
+
colorPalette
|
|
3518
|
+
} = options, blendMode = rootBlendMode, rootOptions = {
|
|
2802
3519
|
bg: baseBg,
|
|
2803
3520
|
blendMode: rootBlendMode,
|
|
2804
3521
|
colorPalette
|
|
@@ -2840,7 +3557,11 @@ function renderThemeColorButtonStates(value, options) {
|
|
|
2840
3557
|
};
|
|
2841
3558
|
}
|
|
2842
3559
|
function renderThemeColorState(value, options) {
|
|
2843
|
-
const {
|
|
3560
|
+
const {
|
|
3561
|
+
baseBg,
|
|
3562
|
+
blendMode: rootBlendMode,
|
|
3563
|
+
colorPalette
|
|
3564
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
2844
3565
|
bg: baseBg,
|
|
2845
3566
|
blendMode: rootBlendMode,
|
|
2846
3567
|
colorPalette
|
|
@@ -2854,8 +3575,16 @@ function renderThemeColorState(value, options) {
|
|
|
2854
3575
|
accent: {
|
|
2855
3576
|
fg: renderColorValue(value.accent.fg, colorOptions)
|
|
2856
3577
|
},
|
|
2857
|
-
avatar: renderThemeColorAvatar(value.avatar, {
|
|
2858
|
-
|
|
3578
|
+
avatar: renderThemeColorAvatar(value.avatar, {
|
|
3579
|
+
baseBg: bg,
|
|
3580
|
+
colorPalette,
|
|
3581
|
+
blendMode
|
|
3582
|
+
}),
|
|
3583
|
+
badge: renderThemeColorBadge(value.badge, {
|
|
3584
|
+
baseBg: bg,
|
|
3585
|
+
colorPalette,
|
|
3586
|
+
blendMode
|
|
3587
|
+
}),
|
|
2859
3588
|
bg,
|
|
2860
3589
|
border: renderColorValue(value.border, colorOptions),
|
|
2861
3590
|
code: {
|
|
@@ -2897,7 +3626,19 @@ function renderInputStatesColorTheme(value, options) {
|
|
|
2897
3626
|
};
|
|
2898
3627
|
}
|
|
2899
3628
|
function renderInputStateColorTheme(value, options) {
|
|
2900
|
-
const {
|
|
3629
|
+
const {
|
|
3630
|
+
baseBg,
|
|
3631
|
+
blendMode: rootBlendMode,
|
|
3632
|
+
colorPalette
|
|
3633
|
+
} = options, blendMode = value._blend || "multiply", rootOptions = {
|
|
3634
|
+
colorPalette,
|
|
3635
|
+
bg: baseBg,
|
|
3636
|
+
blendMode: rootBlendMode
|
|
3637
|
+
}, bg = renderColorValue(value.bg, rootOptions), colorOptions = {
|
|
3638
|
+
colorPalette,
|
|
3639
|
+
bg,
|
|
3640
|
+
blendMode
|
|
3641
|
+
};
|
|
2901
3642
|
return {
|
|
2902
3643
|
_blend: blendMode,
|
|
2903
3644
|
bg,
|
|
@@ -2928,7 +3669,15 @@ function renderThemeColorSelectableStates(value, options) {
|
|
|
2928
3669
|
};
|
|
2929
3670
|
}
|
|
2930
3671
|
function renderSyntaxColorTheme(value, options) {
|
|
2931
|
-
const {
|
|
3672
|
+
const {
|
|
3673
|
+
colorPalette,
|
|
3674
|
+
baseBg,
|
|
3675
|
+
blendMode
|
|
3676
|
+
} = options, colorOptions = {
|
|
3677
|
+
colorPalette,
|
|
3678
|
+
bg: baseBg,
|
|
3679
|
+
blendMode
|
|
3680
|
+
};
|
|
2932
3681
|
return {
|
|
2933
3682
|
atrule: renderColorValue(value.atrule, colorOptions),
|
|
2934
3683
|
attrName: renderColorValue(value.attrName, colorOptions),
|