@dicebear/pixel-art 5.0.3 → 5.1.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/lib/index.js +10 -0
- package/lib/utils/convertColor.js +1 -4
- package/lib/utils/getColors.js +8 -8
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -28,6 +28,16 @@ export const create = ({ prng, options }) => {
|
|
|
28
28
|
'shape-rendering': 'crispEdges'
|
|
29
29
|
},
|
|
30
30
|
body: `<path d="M4 2h8v1h1v3h1v2h-1v3h-1v1H9v1h4v1h1v2H2v-2h1v-1h4v-1H4v-1H3V8H2V6h1V3h1V2Z" fill="${escape.xml(`${colors.skin}`)}"/><path d="M4 2h8v1h1v3h1v2h-1v3h-1v1H4v-1H3V8H2V6h1V3h1V2Z" fill="#fff" fill-opacity=".1"/>${(_b = (_a = components.accessories) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : ''}${(_d = (_c = components.clothing) === null || _c === void 0 ? void 0 : _c.value(components, colors)) !== null && _d !== void 0 ? _d : ''}${(_f = (_e = components.eyes) === null || _e === void 0 ? void 0 : _e.value(components, colors)) !== null && _f !== void 0 ? _f : ''}${(_h = (_g = components.glasses) === null || _g === void 0 ? void 0 : _g.value(components, colors)) !== null && _h !== void 0 ? _h : ''}${(_k = (_j = components.beard) === null || _j === void 0 ? void 0 : _j.value(components, colors)) !== null && _k !== void 0 ? _k : ''}${(_m = (_l = components.mouth) === null || _l === void 0 ? void 0 : _l.value(components, colors)) !== null && _m !== void 0 ? _m : ''}${(_p = (_o = components.hair) === null || _o === void 0 ? void 0 : _o.value(components, colors)) !== null && _p !== void 0 ? _p : ''}`,
|
|
31
|
+
extra: () => ({
|
|
32
|
+
...Object.entries(components).reduce((acc, [key, value]) => {
|
|
33
|
+
acc[key] = value === null || value === void 0 ? void 0 : value.name;
|
|
34
|
+
return acc;
|
|
35
|
+
}, {}),
|
|
36
|
+
...Object.entries(colors).reduce((acc, [key, value]) => {
|
|
37
|
+
acc[`${key}Color`] = value;
|
|
38
|
+
return acc;
|
|
39
|
+
}, {}),
|
|
40
|
+
}),
|
|
31
41
|
};
|
|
32
42
|
};
|
|
33
43
|
export { schema } from './schema.js';
|
package/lib/utils/getColors.js
CHANGED
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { convertColor } from './convertColor.js';
|
|
8
8
|
export function getColors({ prng, options }) {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
10
|
return {
|
|
11
|
-
'accessories': convertColor(
|
|
12
|
-
'clothing': convertColor(
|
|
13
|
-
'eyes': convertColor(
|
|
14
|
-
'glasses': convertColor(
|
|
15
|
-
'hair': convertColor(
|
|
16
|
-
'mouth': convertColor(
|
|
17
|
-
'skin': convertColor(
|
|
11
|
+
'accessories': convertColor(prng.pick((_a = options.accessoriesColor) !== null && _a !== void 0 ? _a : [], 'transparent')),
|
|
12
|
+
'clothing': convertColor(prng.pick((_b = options.clothingColor) !== null && _b !== void 0 ? _b : [], 'transparent')),
|
|
13
|
+
'eyes': convertColor(prng.pick((_c = options.eyesColor) !== null && _c !== void 0 ? _c : [], 'transparent')),
|
|
14
|
+
'glasses': convertColor(prng.pick((_d = options.glassesColor) !== null && _d !== void 0 ? _d : [], 'transparent')),
|
|
15
|
+
'hair': convertColor(prng.pick((_e = options.hairColor) !== null && _e !== void 0 ? _e : [], 'transparent')),
|
|
16
|
+
'mouth': convertColor(prng.pick((_f = options.mouthColor) !== null && _f !== void 0 ? _f : [], 'transparent')),
|
|
17
|
+
'skin': convertColor(prng.pick((_g = options.skinColor) !== null && _g !== void 0 ? _g : [], 'transparent')),
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/pixel-art",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Avatar style for DiceBear",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dicebear"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"test": "uvu tests"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@dicebear/core": "^5.0
|
|
32
|
+
"@dicebear/core": "^5.1.0",
|
|
33
33
|
"@tsconfig/recommended": "^1.0.1",
|
|
34
34
|
"del-cli": "^4.0.1",
|
|
35
35
|
"typescript": "^4.6.3",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4f9e4686aa33809026d6ce25c4a5f2d0750d59f4"
|
|
48
48
|
}
|