Skip to content

Library to generate automatic avatar, providing username, email or fullname from user

License

Notifications You must be signed in to change notification settings

Trukes/avatarholder

Repository files navigation

Avatar Holder

Avatar Holder is a library that generate automatic avatars, with name/username initials.

Image of Avatar Holder Image of Avatar Holder Image of Avatar Holder

Image of Avatar Holder Image of Avatar Holder Image of Avatar Holder

New Features!

  • Save image to file
  • Get initials from person full name

You can also:

  • Choose color from background
  • Save image to any extension you want

Demo

http://www.avatarholder.com

Installation

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');

Options

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

Development

Want to contribute? Great!

Buy pedromcarmo a Coffe Image of Buy pedromcarmo a Coffe