https://github.com/beyonk/initials-avatar
Create avatars from user initials in pure javascript
https://github.com/beyonk/initials-avatar
avatar google image-generation initials
Last synced: 2 days ago
JSON representation
Create avatars from user initials in pure javascript
- Host: GitHub
- URL: https://github.com/beyonk/initials-avatar
- Owner: beyonk
- Created: 2019-10-25T15:48:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2026-06-15T12:49:15.000Z (7 days ago)
- Last Synced: 2026-06-20T06:39:30.558Z (2 days ago)
- Topics: avatar, google, image-generation, initials
- Language: JavaScript
- Size: 94.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README

# Initials Avatar
[](http://standardjs.com)
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
```sh
$ npm install --save @beyonk/initials-avatar
```
## Usage
Add the plugin to your loadtest configuration:
```js
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
```js
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)
```js
await createAvatar({ firstName: 'Antony', lastName: 'MacKenzie-Jones' }, output, { background: '#ff0c7e' })
```