@dicebear/avatars
Pixel-Art Avatar Placeholder Library
Last updated 11 days ago by floriankoerner .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @dicebear/avatars 
SYNC missed versions from official npm registry.

DiceBear Avatars

license npm

Avatars is an avatar placeholder library for designers and developers. You can choose between simple identicons and lovely designed characters. And best of all: We provide a simple and free HTTP API that you can use right away!

https://avatars.dicebear.com

Usage

HTTP-API (recommended)

Our free HTTP-API is the easiest way to use Avatars. Just use the following URL as image source.

https://avatars.dicebear.com/api/:sprites/:seed.svg

Replace :sprites with male, female, human, identicon, initials, bottts, avataaars, jdenticon, gridy or code. The value of :seed can be anything you like - but don't use any sensitive or personal data here!

The used sprite collection may offer additional options, which can be set using the GET parameter named options. For example, to create a happy male avatar with the seed john, the following URL can be used:

https://avatars.dicebear.com/api/male/john.svg?options[mood]=happy

NPM

Choose NPM if you want to use a spriteCollection that is not available via the HTTP-API.

Install the Avatars package with the following command.

npm install --save @dicebear/avatars

You also need to add a sprite collection. In our example, we will use the male sprite collection.

npm install --save @dicebear/avatars-male-sprites

Now you are ready to create your first Avatar.

import Avatars from '@dicebear/avatars';
import sprites from '@dicebear/avatars-male-sprites';

let options = {};
let avatars = new Avatars(sprites, options);
let svg = avatars.create('custom-seed');

Available options

The following options are available for each sprite collection.

name alias type default description
radius r number 0 Avatar border radius
base64 bool false Return avatar as base64 data uri instead of XML
Not supported by the HTTP API
width w number null Fixed width
height h number null Fixed height
margin m number 0 Avatar margin in percent
HTTP-API limitation Max value 25
background b string null Any valid color identifier
HTTP-API limitation Only hex (3-digit, 6-digit and 8-digit) values are allowed. Use url encoded hash: %23.
userAgent string window.navigator.userAgent User-Agent for legacy browser fallback
Automatically detected by the HTTP API

More available options can be found in the README.md of each sprite collection.

Further information

You can find the complete documentation at avatars.dicebear.com

Current Tags

  • 4.2.0                                ...           latest (11 days ago)
  • 3.0.0-3                                ...           next (a year ago)

56 Versions

  • 4.2.0                                ...           11 days ago
  • 4.1.1                                ...           22 days ago
  • 4.1.0                                ...           a month ago
  • 4.1.0-alpha.0                                ...           a month ago
  • 4.0.8                                ...           2 months ago
  • 4.0.5                                ...           3 months ago
  • 4.0.3                                ...           3 months ago
  • 4.0.2                                ...           5 months ago
  • 4.0.1                                ...           5 months ago
  • 4.0.0                                ...           5 months ago
  • 3.1.4                                ...           10 months ago
  • 3.1.3                                ...           a year ago
  • 3.1.1                                ...           a year ago
  • 3.1.0                                ...           a year ago
  • 3.0.7                                ...           a year ago
  • 3.0.6                                ...           a year ago
  • 3.0.5                                ...           a year ago
  • 3.0.4                                ...           a year ago
  • 3.0.3                                ...           a year ago
  • 3.0.2                                ...           a year ago
  • 3.0.1                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 3.0.0-alpha.6                                ...           a year ago
  • 3.0.0-3                                ...           a year ago
  • 3.0.0-2                                ...           2 years ago
  • 3.0.0-1                                ...           2 years ago
  • 3.0.0-0                                ...           2 years ago
  • 2.0.4                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 2.0.0-beta.9                                ...           2 years ago
  • 2.0.0-beta.8                                ...           2 years ago
  • 2.0.0-beta.7                                ...           2 years ago
  • 2.0.0-beta.5                                ...           2 years ago
  • 2.0.0-beta.4                                ...           2 years ago
  • 2.0.0-beta.3                                ...           2 years ago
  • 2.0.0-beta.2                                ...           2 years ago
  • 2.0.0-beta.1                                ...           2 years ago
  • 2.0.0-alpha.4                                ...           2 years ago
  • 2.0.0-alpha.3                                ...           2 years ago
  • 2.0.0-alpha.2                                ...           2 years ago
  • 2.0.0-alpha.1                                ...           2 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.2.4                                ...           3 years ago
  • 0.2.3                                ...           3 years ago
  • 0.2.2                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 3
This Month 3
Last Day 1
Last Week 22
Last Month 156
Dependencies (3)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |