![](https://user-images.githubusercontent.com/218949/144224348-1b3a20d5-d68e-4a7a-b6ac-6946f19f4a86.png)
Generates image based avatars from initials, in node.
Uses a random background colour and a contrasting foreground colour.
Uses pure javascript, no native dependencies.
$ npm install --save @beyonk/initials-avatar
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)
You can change the default avatar size from 128px
await createAvatar({ firstName: 'Antony', lastName: 'MacKenzie-Jones' }, output, { size: 512 })
You can choose the background colour (and the foreground will contrast automatically)
await createAvatar({ firstName: 'Antony', lastName: 'MacKenzie-Jones' }, output, { background: '#ff0c7e' })