Skip to content

beyonk-group/initials-avatar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation





image

Initials Avatar

js-standard-style

Generates image based avatars from initials, in node.

Uses a random background colour and a contrasting foreground colour.

Uses pure javascript, no native dependencies.

Install

$ npm install --save @beyonk/initials-avatar

Usage

Add the plugin to your loadtest configuration:

const { createWriteStream } = require('fs')
const { createAvatar } = require('@beyonk/initials-avatar')

const output = createWriteStream('/some/output/file.jpg')
await createAvatar({ firstName: 'Antony', lastName: 'MacKenzie-Jones' }, output)

Config

Changing avatar size

You can change the default avatar size from 128px

await createAvatar({ firstName: 'Antony', lastName: 'MacKenzie-Jones' }, output, { size: 512 })

Forcing avatar background-colour

You can choose the background colour (and the foreground will contrast automatically)

await createAvatar({ firstName: 'Antony', lastName: 'MacKenzie-Jones' }, output, { background: '#ff0c7e' })

About

Create avatars from user initials in pure javascript

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published