Jdenticon wrapper for DiceBear Avatars.
Usage
HTTP-API (recommended)
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/jdenticon/: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
You also can use the HTTP API as fallback for Gravatar. Use the Gravatar hash as seed
and add the parameter gravatar
to your URL. With the parameter s
you can also define the size of the Gravatar avatar.
https://avatars.dicebear.com/v2/jdenticon/48c424d839214264fc7f65b52235467c.svg?gravatar&s=248
NPM
Install the Avatars and this sprite collection with the following command.
npm install --save @dicebear/avatars @dicebear/avatars-jdenticon-sprites jdenticon
Now you are ready to create your first Avatar.
import Avatars from '@dicebear/avatars';
import sprites from '@dicebear/avatars-jdenticon-sprites';
let options = {};
let avatars = new Avatars(sprites(options));
let svg = avatars.create('custom-seed');
Options
name | type | default | description |
---|
hues | array of numbers between 0 and 360 | null | Icon hue |
padding | number | 0 | Distance to the edge of the image HTTP-API limitation Maximum value: 0.2 |
colorLightness | array of two numbers between 0 and 1 | null | Colored shapes - Lightness |
grayscaleLightness | array of two numbers between 0 and 1 | null | Grayscale shapes - Lightness |
colorSaturation | number between 0 and 1 | null | Colored shapes - Saturation |
grayscaleSaturation | number between 0 and 1 | null | Grayscale shapes - Saturation |
background | 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 . |
Further information
You can find the DiceBear Avatars documentation at avatars.dicebear.com