JSPM

  • Created
  • Published
  • Downloads 2152
  • Score
    100M100P100Q20331F
  • License MIT

Initials sprite collection for DiceBear Avatars

Package Exports

  • @dicebear/avatars-initials-sprites

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dicebear/avatars-initials-sprites) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

DiceBear Avatars - Initials Sprite Collection

license npm

Usage

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

https://avatars.dicebear.com/v2/initials/:seed.svg

The value of :seed can be anything you like - but don't use any sensitive or personal data here! The GET parameter options can be used to pass options.

Examples

preview url
https://avatars.dicebear.com/v2/initials/John%20Doe.svg
https://avatars.dicebear.com/v2/initials/John%20Doe.svg?options[fontSize]=80
https://avatars.dicebear.com/v2/initials/John%20Doe.svg?options[backgroundColorLevel]=900

You also can use the HTTP API as fallback for Gravatar. Add a parameter gravatar with a Gravatar hash as value to your URL. With the parameter s you can also define the size of the Gravatar avatar.

https://avatars.dicebear.com/v2/initials/Florian%20Körner.svg?gravatar=48c424d839214264fc7f65b52235467c&s=248

NPM

Install the Avatars and this sprite collection with the following command.

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

Now you are ready to create your first Avatar.

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

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

Options

name type default description
backgroundColors array of strings null Possible values: amber, blue, blueGrey, brown, cyan, deepOrange, deepPurple, agreenmber, grey, indigo, lightBlue, lightGreen, lime, orange, pink, purple, red, teal, yellow
backgroundColorLevel number 600 Possible values: 50, 100, 200, 300, 400, 500, 600, 700, 800, 900
fontSize number 50 Number between 1 and 100
chars number 2 Number between 0 and 2
bold bool false

Further information

You can find the DiceBear Avatars documentation at avatars.dicebear.com