@dicebear/icons 5.0.0-alpha.11
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/LICENSE +10 -0
- package/README.md +12 -0
- package/lib/colors/background.d.ts +2 -0
- package/lib/colors/background.js +21 -0
- package/lib/colors/index.d.ts +1 -0
- package/lib/colors/index.js +1 -0
- package/lib/components/icon.d.ts +2 -0
- package/lib/components/icon.js +148 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/lib/core.d.ts +3 -0
- package/lib/core.js +66 -0
- package/lib/hooks/onPostCreate.d.ts +11 -0
- package/lib/hooks/onPostCreate.js +3 -0
- package/lib/hooks/onPreCreate.d.ts +9 -0
- package/lib/hooks/onPreCreate.js +3 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +14 -0
- package/lib/meta/components.d.ts +4 -0
- package/lib/meta/components.js +6 -0
- package/lib/schema.d.ts +2 -0
- package/lib/schema.js +506 -0
- package/lib/types.d.ts +20 -0
- package/lib/types.js +1 -0
- package/lib/utils/getColors.d.ts +8 -0
- package/lib/utils/getColors.js +10 -0
- package/lib/utils/getComponents.d.ts +8 -0
- package/lib/utils/getComponents.js +11 -0
- package/lib/utils/pickColor.d.ts +9 -0
- package/lib/utils/pickColor.js +13 -0
- package/lib/utils/pickComponent.d.ts +9 -0
- package/lib/utils/pickComponent.js +14 -0
- package/package.json +48 -0
package/lib/schema.js
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
export const schema = {
|
|
2
|
+
title: 'Options',
|
|
3
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
4
|
+
properties: {
|
|
5
|
+
backgroundColor: {
|
|
6
|
+
type: 'array',
|
|
7
|
+
items: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
pattern: '^([0-9a-zA-Z]+|#[a-fA-F0-9]{3}|#[a-fA-F0-9]{4}|#[a-fA-F0-9]{6}|#[a-fA-F0-9]{8})$',
|
|
10
|
+
},
|
|
11
|
+
default: [
|
|
12
|
+
'amber',
|
|
13
|
+
'blue',
|
|
14
|
+
'blueGray',
|
|
15
|
+
'brown',
|
|
16
|
+
'cyan',
|
|
17
|
+
'deepOrange',
|
|
18
|
+
'deepPurple',
|
|
19
|
+
'green',
|
|
20
|
+
'grey',
|
|
21
|
+
'indigo',
|
|
22
|
+
'lightBlue',
|
|
23
|
+
'lightGreen',
|
|
24
|
+
'lime',
|
|
25
|
+
'orange',
|
|
26
|
+
'pink',
|
|
27
|
+
'purple',
|
|
28
|
+
'red',
|
|
29
|
+
'teal',
|
|
30
|
+
'yellow',
|
|
31
|
+
],
|
|
32
|
+
examples: [
|
|
33
|
+
['amber'],
|
|
34
|
+
['blue'],
|
|
35
|
+
['blueGray'],
|
|
36
|
+
['brown'],
|
|
37
|
+
['cyan'],
|
|
38
|
+
['deepOrange'],
|
|
39
|
+
['deepPurple'],
|
|
40
|
+
['green'],
|
|
41
|
+
['grey'],
|
|
42
|
+
['indigo'],
|
|
43
|
+
['lightBlue'],
|
|
44
|
+
['lightGreen'],
|
|
45
|
+
['lime'],
|
|
46
|
+
['orange'],
|
|
47
|
+
['pink'],
|
|
48
|
+
['purple'],
|
|
49
|
+
['red'],
|
|
50
|
+
['teal'],
|
|
51
|
+
['yellow'],
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
icon: {
|
|
55
|
+
type: 'array',
|
|
56
|
+
items: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
enum: [
|
|
59
|
+
'alarm',
|
|
60
|
+
'archive',
|
|
61
|
+
'award',
|
|
62
|
+
'bag',
|
|
63
|
+
'bandaid',
|
|
64
|
+
'bank',
|
|
65
|
+
'basket',
|
|
66
|
+
'basket2',
|
|
67
|
+
'basket3',
|
|
68
|
+
'bell',
|
|
69
|
+
'bicycle',
|
|
70
|
+
'binoculars',
|
|
71
|
+
'book',
|
|
72
|
+
'bookshelf',
|
|
73
|
+
'boombox',
|
|
74
|
+
'boxSeam',
|
|
75
|
+
'box',
|
|
76
|
+
'boxes',
|
|
77
|
+
'bricks',
|
|
78
|
+
'briefcase',
|
|
79
|
+
'brightnessHigh',
|
|
80
|
+
'brush',
|
|
81
|
+
'bucket',
|
|
82
|
+
'bug',
|
|
83
|
+
'building',
|
|
84
|
+
'calculator',
|
|
85
|
+
'cameraReels',
|
|
86
|
+
'camera',
|
|
87
|
+
'cart2',
|
|
88
|
+
'cashCoin',
|
|
89
|
+
'clock',
|
|
90
|
+
'cloudDrizzle',
|
|
91
|
+
'cloudMoon',
|
|
92
|
+
'cloudSnow',
|
|
93
|
+
'cloud',
|
|
94
|
+
'clouds',
|
|
95
|
+
'coin',
|
|
96
|
+
'compass',
|
|
97
|
+
'controller',
|
|
98
|
+
'cupStraw',
|
|
99
|
+
'cup',
|
|
100
|
+
'dice5',
|
|
101
|
+
'disc',
|
|
102
|
+
'display',
|
|
103
|
+
'doorClosed',
|
|
104
|
+
'doorOpen',
|
|
105
|
+
'dpad',
|
|
106
|
+
'droplet',
|
|
107
|
+
'easel',
|
|
108
|
+
'eggFried',
|
|
109
|
+
'egg',
|
|
110
|
+
'emojiHeartEyes',
|
|
111
|
+
'emojiLaughing',
|
|
112
|
+
'emojiSmileUpsideDown',
|
|
113
|
+
'emojiSmile',
|
|
114
|
+
'emojiSunglasses',
|
|
115
|
+
'emojiWink',
|
|
116
|
+
'envelope',
|
|
117
|
+
'eyeglasses',
|
|
118
|
+
'flag',
|
|
119
|
+
'flower1',
|
|
120
|
+
'flower2',
|
|
121
|
+
'flower3',
|
|
122
|
+
'gem',
|
|
123
|
+
'gift',
|
|
124
|
+
'globe',
|
|
125
|
+
'globe2',
|
|
126
|
+
'handThumbsUp',
|
|
127
|
+
'handbag',
|
|
128
|
+
'hdd',
|
|
129
|
+
'heart',
|
|
130
|
+
'hourglassSplit',
|
|
131
|
+
'hourglass',
|
|
132
|
+
'houseDoor',
|
|
133
|
+
'house',
|
|
134
|
+
'inbox',
|
|
135
|
+
'inboxes',
|
|
136
|
+
'key',
|
|
137
|
+
'keyboard',
|
|
138
|
+
'ladder',
|
|
139
|
+
'lamp',
|
|
140
|
+
'laptop',
|
|
141
|
+
'lightbulb',
|
|
142
|
+
'lightningCharge',
|
|
143
|
+
'lightning',
|
|
144
|
+
'lock',
|
|
145
|
+
'magic',
|
|
146
|
+
'mailbox',
|
|
147
|
+
'map',
|
|
148
|
+
'megaphone',
|
|
149
|
+
'minecartLoaded',
|
|
150
|
+
'minecart',
|
|
151
|
+
'moonStars',
|
|
152
|
+
'moon',
|
|
153
|
+
'mortarboard',
|
|
154
|
+
'mouse',
|
|
155
|
+
'mouse2',
|
|
156
|
+
'newspaper',
|
|
157
|
+
'paintBucket',
|
|
158
|
+
'palette',
|
|
159
|
+
'palette2',
|
|
160
|
+
'paperclip',
|
|
161
|
+
'pen',
|
|
162
|
+
'pencil',
|
|
163
|
+
'phone',
|
|
164
|
+
'piggyBank',
|
|
165
|
+
'pinAngle',
|
|
166
|
+
'plug',
|
|
167
|
+
'printer',
|
|
168
|
+
'projector',
|
|
169
|
+
'puzzle',
|
|
170
|
+
'router',
|
|
171
|
+
'scissors',
|
|
172
|
+
'sdCard',
|
|
173
|
+
'search',
|
|
174
|
+
'send',
|
|
175
|
+
'shopWindow',
|
|
176
|
+
'shop',
|
|
177
|
+
'signpost2',
|
|
178
|
+
'signpostSplit',
|
|
179
|
+
'signpost',
|
|
180
|
+
'smartwatch',
|
|
181
|
+
'snow',
|
|
182
|
+
'snow2',
|
|
183
|
+
'snow3',
|
|
184
|
+
'speaker',
|
|
185
|
+
'star',
|
|
186
|
+
'stoplights',
|
|
187
|
+
'stopwatch',
|
|
188
|
+
'sun',
|
|
189
|
+
'tablet',
|
|
190
|
+
'thermometer',
|
|
191
|
+
'ticketPerforated',
|
|
192
|
+
'tornado',
|
|
193
|
+
'trash',
|
|
194
|
+
'trash2',
|
|
195
|
+
'tree',
|
|
196
|
+
'trophy',
|
|
197
|
+
'truckFlatbed',
|
|
198
|
+
'truck',
|
|
199
|
+
'tsunami',
|
|
200
|
+
'umbrella',
|
|
201
|
+
'wallet',
|
|
202
|
+
'wallet2',
|
|
203
|
+
'watch',
|
|
204
|
+
'webcam',
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
default: [
|
|
208
|
+
'alarm',
|
|
209
|
+
'archive',
|
|
210
|
+
'award',
|
|
211
|
+
'bag',
|
|
212
|
+
'bandaid',
|
|
213
|
+
'bank',
|
|
214
|
+
'basket',
|
|
215
|
+
'basket2',
|
|
216
|
+
'basket3',
|
|
217
|
+
'bell',
|
|
218
|
+
'bicycle',
|
|
219
|
+
'binoculars',
|
|
220
|
+
'book',
|
|
221
|
+
'bookshelf',
|
|
222
|
+
'boombox',
|
|
223
|
+
'boxSeam',
|
|
224
|
+
'box',
|
|
225
|
+
'boxes',
|
|
226
|
+
'bricks',
|
|
227
|
+
'briefcase',
|
|
228
|
+
'brightnessHigh',
|
|
229
|
+
'brush',
|
|
230
|
+
'bucket',
|
|
231
|
+
'bug',
|
|
232
|
+
'building',
|
|
233
|
+
'calculator',
|
|
234
|
+
'cameraReels',
|
|
235
|
+
'camera',
|
|
236
|
+
'cart2',
|
|
237
|
+
'cashCoin',
|
|
238
|
+
'clock',
|
|
239
|
+
'cloudDrizzle',
|
|
240
|
+
'cloudMoon',
|
|
241
|
+
'cloudSnow',
|
|
242
|
+
'cloud',
|
|
243
|
+
'clouds',
|
|
244
|
+
'coin',
|
|
245
|
+
'compass',
|
|
246
|
+
'controller',
|
|
247
|
+
'cupStraw',
|
|
248
|
+
'cup',
|
|
249
|
+
'dice5',
|
|
250
|
+
'disc',
|
|
251
|
+
'display',
|
|
252
|
+
'doorClosed',
|
|
253
|
+
'doorOpen',
|
|
254
|
+
'dpad',
|
|
255
|
+
'droplet',
|
|
256
|
+
'easel',
|
|
257
|
+
'eggFried',
|
|
258
|
+
'egg',
|
|
259
|
+
'emojiHeartEyes',
|
|
260
|
+
'emojiLaughing',
|
|
261
|
+
'emojiSmileUpsideDown',
|
|
262
|
+
'emojiSmile',
|
|
263
|
+
'emojiSunglasses',
|
|
264
|
+
'emojiWink',
|
|
265
|
+
'envelope',
|
|
266
|
+
'eyeglasses',
|
|
267
|
+
'flag',
|
|
268
|
+
'flower1',
|
|
269
|
+
'flower2',
|
|
270
|
+
'flower3',
|
|
271
|
+
'gem',
|
|
272
|
+
'gift',
|
|
273
|
+
'globe',
|
|
274
|
+
'globe2',
|
|
275
|
+
'handThumbsUp',
|
|
276
|
+
'handbag',
|
|
277
|
+
'hdd',
|
|
278
|
+
'heart',
|
|
279
|
+
'hourglassSplit',
|
|
280
|
+
'hourglass',
|
|
281
|
+
'houseDoor',
|
|
282
|
+
'house',
|
|
283
|
+
'inbox',
|
|
284
|
+
'inboxes',
|
|
285
|
+
'key',
|
|
286
|
+
'keyboard',
|
|
287
|
+
'ladder',
|
|
288
|
+
'lamp',
|
|
289
|
+
'laptop',
|
|
290
|
+
'lightbulb',
|
|
291
|
+
'lightningCharge',
|
|
292
|
+
'lightning',
|
|
293
|
+
'lock',
|
|
294
|
+
'magic',
|
|
295
|
+
'mailbox',
|
|
296
|
+
'map',
|
|
297
|
+
'megaphone',
|
|
298
|
+
'minecartLoaded',
|
|
299
|
+
'minecart',
|
|
300
|
+
'moonStars',
|
|
301
|
+
'moon',
|
|
302
|
+
'mortarboard',
|
|
303
|
+
'mouse',
|
|
304
|
+
'mouse2',
|
|
305
|
+
'newspaper',
|
|
306
|
+
'paintBucket',
|
|
307
|
+
'palette',
|
|
308
|
+
'palette2',
|
|
309
|
+
'paperclip',
|
|
310
|
+
'pen',
|
|
311
|
+
'pencil',
|
|
312
|
+
'phone',
|
|
313
|
+
'piggyBank',
|
|
314
|
+
'pinAngle',
|
|
315
|
+
'plug',
|
|
316
|
+
'printer',
|
|
317
|
+
'projector',
|
|
318
|
+
'puzzle',
|
|
319
|
+
'router',
|
|
320
|
+
'scissors',
|
|
321
|
+
'sdCard',
|
|
322
|
+
'search',
|
|
323
|
+
'send',
|
|
324
|
+
'shopWindow',
|
|
325
|
+
'shop',
|
|
326
|
+
'signpost2',
|
|
327
|
+
'signpostSplit',
|
|
328
|
+
'signpost',
|
|
329
|
+
'smartwatch',
|
|
330
|
+
'snow',
|
|
331
|
+
'snow2',
|
|
332
|
+
'snow3',
|
|
333
|
+
'speaker',
|
|
334
|
+
'star',
|
|
335
|
+
'stoplights',
|
|
336
|
+
'stopwatch',
|
|
337
|
+
'sun',
|
|
338
|
+
'tablet',
|
|
339
|
+
'thermometer',
|
|
340
|
+
'ticketPerforated',
|
|
341
|
+
'tornado',
|
|
342
|
+
'trash',
|
|
343
|
+
'trash2',
|
|
344
|
+
'tree',
|
|
345
|
+
'trophy',
|
|
346
|
+
'truckFlatbed',
|
|
347
|
+
'truck',
|
|
348
|
+
'tsunami',
|
|
349
|
+
'umbrella',
|
|
350
|
+
'wallet',
|
|
351
|
+
'wallet2',
|
|
352
|
+
'watch',
|
|
353
|
+
'webcam',
|
|
354
|
+
],
|
|
355
|
+
examples: [
|
|
356
|
+
['alarm'],
|
|
357
|
+
['archive'],
|
|
358
|
+
['award'],
|
|
359
|
+
['bag'],
|
|
360
|
+
['bandaid'],
|
|
361
|
+
['bank'],
|
|
362
|
+
['basket'],
|
|
363
|
+
['basket2'],
|
|
364
|
+
['basket3'],
|
|
365
|
+
['bell'],
|
|
366
|
+
['bicycle'],
|
|
367
|
+
['binoculars'],
|
|
368
|
+
['book'],
|
|
369
|
+
['bookshelf'],
|
|
370
|
+
['boombox'],
|
|
371
|
+
['boxSeam'],
|
|
372
|
+
['box'],
|
|
373
|
+
['boxes'],
|
|
374
|
+
['bricks'],
|
|
375
|
+
['briefcase'],
|
|
376
|
+
['brightnessHigh'],
|
|
377
|
+
['brush'],
|
|
378
|
+
['bucket'],
|
|
379
|
+
['bug'],
|
|
380
|
+
['building'],
|
|
381
|
+
['calculator'],
|
|
382
|
+
['cameraReels'],
|
|
383
|
+
['camera'],
|
|
384
|
+
['cart2'],
|
|
385
|
+
['cashCoin'],
|
|
386
|
+
['clock'],
|
|
387
|
+
['cloudDrizzle'],
|
|
388
|
+
['cloudMoon'],
|
|
389
|
+
['cloudSnow'],
|
|
390
|
+
['cloud'],
|
|
391
|
+
['clouds'],
|
|
392
|
+
['coin'],
|
|
393
|
+
['compass'],
|
|
394
|
+
['controller'],
|
|
395
|
+
['cupStraw'],
|
|
396
|
+
['cup'],
|
|
397
|
+
['dice5'],
|
|
398
|
+
['disc'],
|
|
399
|
+
['display'],
|
|
400
|
+
['doorClosed'],
|
|
401
|
+
['doorOpen'],
|
|
402
|
+
['dpad'],
|
|
403
|
+
['droplet'],
|
|
404
|
+
['easel'],
|
|
405
|
+
['eggFried'],
|
|
406
|
+
['egg'],
|
|
407
|
+
['emojiHeartEyes'],
|
|
408
|
+
['emojiLaughing'],
|
|
409
|
+
['emojiSmileUpsideDown'],
|
|
410
|
+
['emojiSmile'],
|
|
411
|
+
['emojiSunglasses'],
|
|
412
|
+
['emojiWink'],
|
|
413
|
+
['envelope'],
|
|
414
|
+
['eyeglasses'],
|
|
415
|
+
['flag'],
|
|
416
|
+
['flower1'],
|
|
417
|
+
['flower2'],
|
|
418
|
+
['flower3'],
|
|
419
|
+
['gem'],
|
|
420
|
+
['gift'],
|
|
421
|
+
['globe'],
|
|
422
|
+
['globe2'],
|
|
423
|
+
['handThumbsUp'],
|
|
424
|
+
['handbag'],
|
|
425
|
+
['hdd'],
|
|
426
|
+
['heart'],
|
|
427
|
+
['hourglassSplit'],
|
|
428
|
+
['hourglass'],
|
|
429
|
+
['houseDoor'],
|
|
430
|
+
['house'],
|
|
431
|
+
['inbox'],
|
|
432
|
+
['inboxes'],
|
|
433
|
+
['key'],
|
|
434
|
+
['keyboard'],
|
|
435
|
+
['ladder'],
|
|
436
|
+
['lamp'],
|
|
437
|
+
['laptop'],
|
|
438
|
+
['lightbulb'],
|
|
439
|
+
['lightningCharge'],
|
|
440
|
+
['lightning'],
|
|
441
|
+
['lock'],
|
|
442
|
+
['magic'],
|
|
443
|
+
['mailbox'],
|
|
444
|
+
['map'],
|
|
445
|
+
['megaphone'],
|
|
446
|
+
['minecartLoaded'],
|
|
447
|
+
['minecart'],
|
|
448
|
+
['moonStars'],
|
|
449
|
+
['moon'],
|
|
450
|
+
['mortarboard'],
|
|
451
|
+
['mouse'],
|
|
452
|
+
['mouse2'],
|
|
453
|
+
['newspaper'],
|
|
454
|
+
['paintBucket'],
|
|
455
|
+
['palette'],
|
|
456
|
+
['palette2'],
|
|
457
|
+
['paperclip'],
|
|
458
|
+
['pen'],
|
|
459
|
+
['pencil'],
|
|
460
|
+
['phone'],
|
|
461
|
+
['piggyBank'],
|
|
462
|
+
['pinAngle'],
|
|
463
|
+
['plug'],
|
|
464
|
+
['printer'],
|
|
465
|
+
['projector'],
|
|
466
|
+
['puzzle'],
|
|
467
|
+
['router'],
|
|
468
|
+
['scissors'],
|
|
469
|
+
['sdCard'],
|
|
470
|
+
['search'],
|
|
471
|
+
['send'],
|
|
472
|
+
['shopWindow'],
|
|
473
|
+
['shop'],
|
|
474
|
+
['signpost2'],
|
|
475
|
+
['signpostSplit'],
|
|
476
|
+
['signpost'],
|
|
477
|
+
['smartwatch'],
|
|
478
|
+
['snow'],
|
|
479
|
+
['snow2'],
|
|
480
|
+
['snow3'],
|
|
481
|
+
['speaker'],
|
|
482
|
+
['star'],
|
|
483
|
+
['stoplights'],
|
|
484
|
+
['stopwatch'],
|
|
485
|
+
['sun'],
|
|
486
|
+
['tablet'],
|
|
487
|
+
['thermometer'],
|
|
488
|
+
['ticketPerforated'],
|
|
489
|
+
['tornado'],
|
|
490
|
+
['trash'],
|
|
491
|
+
['trash2'],
|
|
492
|
+
['tree'],
|
|
493
|
+
['trophy'],
|
|
494
|
+
['truckFlatbed'],
|
|
495
|
+
['truck'],
|
|
496
|
+
['tsunami'],
|
|
497
|
+
['umbrella'],
|
|
498
|
+
['wallet'],
|
|
499
|
+
['wallet2'],
|
|
500
|
+
['watch'],
|
|
501
|
+
['webcam'],
|
|
502
|
+
],
|
|
503
|
+
},
|
|
504
|
+
},
|
|
505
|
+
additionalProperties: false,
|
|
506
|
+
};
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Options {
|
|
2
|
+
icon?: ('alarm' | 'archive' | 'award' | 'bag' | 'bandaid' | 'bank' | 'basket' | 'basket2' | 'basket3' | 'bell' | 'bicycle' | 'binoculars' | 'book' | 'bookshelf' | 'boombox' | 'boxSeam' | 'box' | 'boxes' | 'bricks' | 'briefcase' | 'brightnessHigh' | 'brush' | 'bucket' | 'bug' | 'building' | 'calculator' | 'cameraReels' | 'camera' | 'cart2' | 'cashCoin' | 'clock' | 'cloudDrizzle' | 'cloudMoon' | 'cloudSnow' | 'cloud' | 'clouds' | 'coin' | 'compass' | 'controller' | 'cupStraw' | 'cup' | 'dice5' | 'disc' | 'display' | 'doorClosed' | 'doorOpen' | 'dpad' | 'droplet' | 'easel' | 'eggFried' | 'egg' | 'emojiHeartEyes' | 'emojiLaughing' | 'emojiSmileUpsideDown' | 'emojiSmile' | 'emojiSunglasses' | 'emojiWink' | 'envelope' | 'eyeglasses' | 'flag' | 'flower1' | 'flower2' | 'flower3' | 'gem' | 'gift' | 'globe' | 'globe2' | 'handThumbsUp' | 'handbag' | 'hdd' | 'heart' | 'hourglassSplit' | 'hourglass' | 'houseDoor' | 'house' | 'inbox' | 'inboxes' | 'key' | 'keyboard' | 'ladder' | 'lamp' | 'laptop' | 'lightbulb' | 'lightningCharge' | 'lightning' | 'lock' | 'magic' | 'mailbox' | 'map' | 'megaphone' | 'minecartLoaded' | 'minecart' | 'moonStars' | 'moon' | 'mortarboard' | 'mouse' | 'mouse2' | 'newspaper' | 'paintBucket' | 'palette' | 'palette2' | 'paperclip' | 'pen' | 'pencil' | 'phone' | 'piggyBank' | 'pinAngle' | 'plug' | 'printer' | 'projector' | 'puzzle' | 'router' | 'scissors' | 'sdCard' | 'search' | 'send' | 'shopWindow' | 'shop' | 'signpost2' | 'signpostSplit' | 'signpost' | 'smartwatch' | 'snow' | 'snow2' | 'snow3' | 'speaker' | 'star' | 'stoplights' | 'stopwatch' | 'sun' | 'tablet' | 'thermometer' | 'ticketPerforated' | 'tornado' | 'trash' | 'trash2' | 'tree' | 'trophy' | 'truckFlatbed' | 'truck' | 'tsunami' | 'umbrella' | 'wallet' | 'wallet2' | 'watch' | 'webcam')[];
|
|
3
|
+
backgroundColor?: string[];
|
|
4
|
+
}
|
|
5
|
+
export declare type ColorGroup = Record<string, ColorGroupItem>;
|
|
6
|
+
export declare type ColorGroupCollection = Record<string, ColorGroup>;
|
|
7
|
+
export declare type ColorGroupItem = string;
|
|
8
|
+
export declare type ColorPickCollection = Record<string, ColorPick>;
|
|
9
|
+
export declare type ColorPick = {
|
|
10
|
+
name: string;
|
|
11
|
+
value: ColorGroupItem;
|
|
12
|
+
};
|
|
13
|
+
export declare type ComponentGroup = Record<string, ComponentGroupItem>;
|
|
14
|
+
export declare type ComponentGroupCollection = Record<string, ComponentGroup>;
|
|
15
|
+
export declare type ComponentGroupItem = (components: ComponentPickCollection, colors: ColorPickCollection) => string;
|
|
16
|
+
export declare type ComponentPickCollection = Record<string, ComponentPick>;
|
|
17
|
+
export declare type ComponentPick = {
|
|
18
|
+
name: string;
|
|
19
|
+
value: ComponentGroupItem;
|
|
20
|
+
} | undefined;
|
package/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Prng } from '@dicebear/core';
|
|
2
|
+
import type { Options, ColorPickCollection } from '../types.js';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
prng: Prng;
|
|
5
|
+
options: Options;
|
|
6
|
+
};
|
|
7
|
+
export declare function getColors({ prng, options }: Props): ColorPickCollection;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Prng } from '@dicebear/core';
|
|
2
|
+
import type { Options, ComponentPickCollection } from '../types.js';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
prng: Prng;
|
|
5
|
+
options: Options;
|
|
6
|
+
};
|
|
7
|
+
export declare function getComponents({ prng, options, }: Props): ComponentPickCollection;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Prng } from '@dicebear/core';
|
|
2
|
+
import type { ColorPick } from '../types.js';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
prng: Prng;
|
|
5
|
+
group: string;
|
|
6
|
+
values?: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function pickColor({ prng, group, values }: Props): ColorPick;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as colors from '../colors/index.js';
|
|
2
|
+
export function pickColor({ prng, group, values = [] }) {
|
|
3
|
+
var _a;
|
|
4
|
+
const colorCollection = colors;
|
|
5
|
+
if (values.length === 0) {
|
|
6
|
+
values.push('transparent');
|
|
7
|
+
}
|
|
8
|
+
const key = prng.pick(values);
|
|
9
|
+
return {
|
|
10
|
+
name: key,
|
|
11
|
+
value: (_a = colorCollection[group][key]) !== null && _a !== void 0 ? _a : key,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Prng } from '@dicebear/core';
|
|
2
|
+
import type { ComponentPick } from '../types.js';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
prng: Prng;
|
|
5
|
+
group: string;
|
|
6
|
+
values?: string[];
|
|
7
|
+
};
|
|
8
|
+
export declare function pickComponent({ prng, group, values, }: Props): ComponentPick;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as components from '../components/index.js';
|
|
2
|
+
export function pickComponent({ prng, group, values = [], }) {
|
|
3
|
+
const componentCollection = components;
|
|
4
|
+
const key = prng.pick(values);
|
|
5
|
+
if (componentCollection[group][key]) {
|
|
6
|
+
return {
|
|
7
|
+
name: key,
|
|
8
|
+
value: componentCollection[group][key],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dicebear/icons",
|
|
3
|
+
"version": "5.0.0-alpha.11",
|
|
4
|
+
"description": "Avatar style for DiceBear",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dicebear"
|
|
7
|
+
],
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/dicebear/dicebear/issues"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/dicebear/dicebear.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"exports": "./lib/index.js",
|
|
18
|
+
"types": "./lib/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"lib",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"prebuild": "del-cli lib",
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"test": "uvu tests"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@dicebear/core": "^5.0.0-alpha.11",
|
|
32
|
+
"@tsconfig/recommended": "^1.0.0",
|
|
33
|
+
"@types/jest": "^26.0.22",
|
|
34
|
+
"del-cli": "^4.0.1",
|
|
35
|
+
"typescript": "^4.5.2",
|
|
36
|
+
"uvu": "^0.5.2"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@dicebear/core": "^5.0.0-alpha.10"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "93e6f1be9fff392ded1f18c8320b6a0ca8e695c1"
|
|
48
|
+
}
|