@dicebear/initials
Advanced tools
Comparing version 5.0.0-alpha.31 to 5.0.0-alpha.32
import { schema } from './schema.js'; | ||
import initials from 'initials'; | ||
const colors = { | ||
amber: 'rgba(255, 179, 0, 1)', | ||
blue: 'rgba(30, 136, 229, 1)', | ||
blueGrey: 'rgba(84, 110, 122, 1)', | ||
brown: 'rgba(109, 76, 65, 1)', | ||
cyan: 'rgba(0, 172, 193, 1)', | ||
deepOrange: 'rgba(244, 81, 30, 1)', | ||
deepPurple: 'rgba(94, 53, 177, 1)', | ||
green: 'rgba(67, 160, 71, 1)', | ||
grey: 'rgba(117, 117, 117, 1)', | ||
indigo: 'rgba(57, 73, 171, 1)', | ||
lightBlue: 'rgba(3, 155, 229, 1)', | ||
lightGreen: 'rgba(124, 179, 66, 1)', | ||
lime: 'rgba(192, 202, 51, 1)', | ||
orange: 'rgba(251, 140, 0, 1)', | ||
pink: 'rgba(216, 27, 96, 1)', | ||
purple: 'rgba(142, 36, 170, 1)', | ||
red: 'rgba(229, 57, 53, 1)', | ||
teal: 'rgba(0, 137, 123, 1)', | ||
yellow: 'rgba(253, 216, 53, 1)', | ||
}; | ||
export const style = { | ||
@@ -36,10 +15,9 @@ meta: { | ||
create: ({ prng, options }) => { | ||
var _a, _b, _c, _d, _e, _f; | ||
options.backgroundColor = (_a = options.backgroundColor) === null || _a === void 0 ? void 0 : _a.map((val) => { var _a; return (_a = colors[val]) !== null && _a !== void 0 ? _a : val; }); | ||
const fontFamily = (_c = (_b = options.fontFamily) === null || _b === void 0 ? void 0 : _b.join(', ')) !== null && _c !== void 0 ? _c : 'Arial, sans-serif'; | ||
const fontSize = (_d = options.fontSize) !== null && _d !== void 0 ? _d : 50; | ||
const fontWeight = (_e = options.fontWeight) !== null && _e !== void 0 ? _e : 400; | ||
var _a, _b, _c, _d, _e; | ||
const fontFamily = (_b = (_a = options.fontFamily) === null || _a === void 0 ? void 0 : _a.join(', ')) !== null && _b !== void 0 ? _b : 'Arial, sans-serif'; | ||
const fontSize = (_c = options.fontSize) !== null && _c !== void 0 ? _c : 50; | ||
const fontWeight = (_d = options.fontWeight) !== null && _d !== void 0 ? _d : 400; | ||
const seedInitials = initials(prng.seed.trim()) | ||
.toLocaleUpperCase() | ||
.slice(0, (_f = options.chars) !== null && _f !== void 0 ? _f : 2); | ||
.slice(0, (_e = options.chars) !== null && _e !== void 0 ? _e : 2); | ||
// prettier-ignore | ||
@@ -46,0 +24,0 @@ const svg = [ |
@@ -9,46 +9,22 @@ export const schema = { | ||
type: 'string', | ||
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})$', | ||
pattern: '^#([a-fA-F0-9]{3}|[a-fA-F0-9]{4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$', | ||
}, | ||
default: [ | ||
'amber', | ||
'blue', | ||
'blueGrey', | ||
'brown', | ||
'cyan', | ||
'deepOrange', | ||
'deepPurple', | ||
'green', | ||
'grey', | ||
'indigo', | ||
'lightBlue', | ||
'lightGreen', | ||
'lime', | ||
'orange', | ||
'pink', | ||
'purple', | ||
'red', | ||
'teal', | ||
'yellow', | ||
'e53935', | ||
'd81b60', | ||
'8e24aa', | ||
'5e35b1', | ||
'3949ab', | ||
'1e88e5', | ||
'039be5', | ||
'00acc1', | ||
'00897b', | ||
'43a047', | ||
'7cb342', | ||
'c0ca33', | ||
'fdd835', | ||
'ffb300', | ||
'fb8c00', | ||
'f4511e', | ||
], | ||
examples: [ | ||
['amber'], | ||
['blue'], | ||
['blueGrey'], | ||
['brown'], | ||
['cyan'], | ||
['deepOrange'], | ||
['deepPurple'], | ||
['green'], | ||
['grey'], | ||
['indigo'], | ||
['lightBlue'], | ||
['lightGreen'], | ||
['lime'], | ||
['orange'], | ||
['pink'], | ||
['purple'], | ||
['red'], | ||
['teal'], | ||
['yellow'], | ||
], | ||
}, | ||
@@ -55,0 +31,0 @@ fontFamily: { |
{ | ||
"name": "@dicebear/initials", | ||
"version": "5.0.0-alpha.31", | ||
"version": "5.0.0-alpha.32", | ||
"description": "Initials avatar style for DiceBear", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@dicebear/core": "^5.0.0-alpha.31", | ||
"@dicebear/core": "^5.0.0-alpha.32", | ||
"@tsconfig/recommended": "^1.0.1", | ||
@@ -50,3 +50,3 @@ "del-cli": "^4.0.1", | ||
}, | ||
"gitHead": "088e33eb5bc45d01c9b6350011d973a5bd23bcc8" | ||
"gitHead": "5a4a06cbb8aca42a5d19da8e704b3a7b3a45d755" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7089
141