Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dicebear/initials

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dicebear/initials - npm Package Compare versions

Comparing version 5.0.0-alpha.11 to 5.0.0-alpha.12

17

lib/core.js

@@ -36,16 +36,17 @@ import { schema } from './schema.js';

create: ({ prng, options }) => {
var _a, _b, _c;
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; });
let fontFamily = 'Arial,sans-serif';
let fontSize = ((_b = options.fontSize) !== null && _b !== void 0 ? _b : 50) / 100;
let seedInitials = initials(prng.seed.trim())
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;
const seedInitials = initials(prng.seed.trim())
.toLocaleUpperCase()
.slice(0, (_c = options.chars) !== null && _c !== void 0 ? _c : 2);
.slice(0, (_f = options.chars) !== null && _f !== void 0 ? _f : 2);
// prettier-ignore
let svg = [
`<text x="50%" y="50%" style="${options.bold ? 'font-weight: bold;' : ''} font-family: ${fontFamily}; font-size: ${fontSize}px" fill="#FFF" text-anchor="middle" dy="${(fontSize * .356).toFixed(3)}">${seedInitials}</text>`,
const svg = [
`<text x="50%" y="50%" font-family="${fontFamily}" font-size="${fontSize}" fontWeight="${fontWeight}" fill="#FFF" text-anchor="middle" dy="${(fontSize * .356).toFixed(3)}">${seedInitials}</text>`,
].join('');
return {
attributes: {
viewBox: '0 0 1 1',
viewBox: '0 0 100 100',
},

@@ -52,0 +53,0 @@ body: svg,

@@ -6,5 +6,3 @@ export const schema = {

backgroundColor: {
title: 'Background Color',
type: 'array',
uniqueItems: true,
items: {

@@ -57,4 +55,27 @@ type: 'string',

},
fontFamily: {
type: 'array',
uniqueItems: true,
minItems: 1,
items: {
type: 'string',
pattern: '^[a-zA-Z0-9\\-\\s]+$',
},
default: ['Arial', 'sans-serif'],
examples: [
['Arial'],
['Verdana'],
['Helvetica'],
['Tahoma'],
['Trebuchet MS'],
['Times New Roman'],
['Georgia'],
['Garamond'],
['Courier New'],
['Brush Script MT'],
['sans-serif'],
['serif'],
],
},
fontSize: {
title: 'Font Size',
type: 'integer',

@@ -64,5 +85,5 @@ minimum: 1,

default: 50,
examples: [25, 50, 75, 100],
},
chars: {
title: 'Chars',
type: 'number',

@@ -72,6 +93,9 @@ minimum: 0,

default: 2,
examples: [1, 2],
},
bold: {
title: 'Bold',
type: 'boolean',
fontWeight: {
type: 'number',
default: 400,
enum: [100, 200, 300, 400, 500, 600, 700, 800, 900],
examples: [100, 200, 300, 400, 500, 600, 700, 800, 900],
},

@@ -78,0 +102,0 @@ },

export interface Options {
backgroundColor?: string[];
fontFamily?: string[];
fontSize?: number;
chars?: number;
bold?: boolean;
fontWeight?: number;
}
{
"name": "@dicebear/initials",
"version": "5.0.0-alpha.11",
"version": "5.0.0-alpha.12",
"description": "Initials avatar style for DiceBear",

@@ -34,3 +34,3 @@ "keywords": [

"devDependencies": {
"@dicebear/core": "^5.0.0-alpha.11",
"@dicebear/core": "^5.0.0-alpha.12",
"@tsconfig/recommended": "^1.0.0",

@@ -51,3 +51,3 @@ "@types/jest": "^26.0.22",

},
"gitHead": "93e6f1be9fff392ded1f18c8320b6a0ca8e695c1"
"gitHead": "baa9eec32902faa13b4727237a99dbdba1f382c8"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc