Avatar Holder is a library that generate automatic avatars, with name/username initials.
- Save image to file
- Get initials from person full name
You can also:
- Choose color from background
- Save image to any extension you want
Install into your project
npm install avatarholder --save
Require avatarholder library
let avatarholder = require('avatarholder');
Or import
import * as avatarholder from 'avatarholder';
And start to generating your avatars...
let image = avatarholder.generateAvatar('Hello World');
or save into files...
let pathFile = avatarholder.generateAvatarToFile('Hello World', './my-avatar.png');
Avatar Holder can receive options, always on last param.
let responseToFile = avatarholder.generateAvatarToFile(
'Hello World',
'./my-avatar.jpg',
{
size: 600,
bgColor: '#eee'
}
);
Full options available (optional):
Options | Default | Description |
---|---|---|
size | 100 | Image size in pixels |
font | 40 | Font size in pixels |
bgColor | - | Background color. Random color if not sent |
color | - | Constrast with background color if not sent |
Want to contribute? Great!