@dicebear/initials 5.0.4 → 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 CHANGED
@@ -21,16 +21,23 @@ export const create = ({ prng, options }) => {
21
21
  const fontSize = (_c = options.fontSize) !== null && _c !== void 0 ? _c : 50;
22
22
  const fontWeight = (_d = options.fontWeight) !== null && _d !== void 0 ? _d : 400;
23
23
  const textColor = convertColor((_f = prng.pick((_e = options.textColor) !== null && _e !== void 0 ? _e : [])) !== null && _f !== void 0 ? _f : 'ffffff');
24
- const seedInitials = getInitials(prng.seed.trim()).slice(0, (_g = options.chars) !== null && _g !== void 0 ? _g : 2);
24
+ const initials = getInitials(prng.seed.trim()).slice(0, (_g = options.chars) !== null && _g !== void 0 ? _g : 2);
25
25
  // prettier-ignore
26
26
  const svg = [
27
- `<text x="50%" y="50%" font-family="${fontFamily}" font-size="${fontSize}" font-weight="${fontWeight}" fill="${textColor}" text-anchor="middle" dy="${(fontSize * .356).toFixed(3)}">${seedInitials}</text>`,
27
+ `<text x="50%" y="50%" font-family="${fontFamily}" font-size="${fontSize}" font-weight="${fontWeight}" fill="${textColor}" text-anchor="middle" dy="${(fontSize * .356).toFixed(3)}">${initials}</text>`,
28
28
  ].join('');
29
29
  return {
30
30
  attributes: {
31
31
  viewBox: '0 0 100 100',
32
32
  },
33
33
  body: svg,
34
+ extra: () => ({
35
+ fontFamily,
36
+ fontSize,
37
+ fontWeight,
38
+ textColor,
39
+ initials
40
+ })
34
41
  };
35
42
  };
36
43
  export { schema } from './schema.js';
@@ -5,8 +5,5 @@
5
5
  * File: https://www.figma.com/file/BRj9eonsORJ7GIUdm8gnu5
6
6
  */
7
7
  export function convertColor(color) {
8
- if ('transparent' === color) {
9
- return color;
10
- }
11
- return `#${color}`;
8
+ return 'transparent' === color ? color : `#${color}`;
12
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dicebear/initials",
3
- "version": "5.0.4",
3
+ "version": "5.1.0",
4
4
  "description": "Initials 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.4",
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": "0158d13ad3760498a3622ca8bda8420929acc6dc"
47
+ "gitHead": "4f9e4686aa33809026d6ce25c4a5f2d0750d59f4"
48
48
  }