4.2.5 • Published 4 years ago

@dicebear/avatars-code-sprites v4.2.5

Weekly downloads
14
License
MIT
Repository
github
Last release
4 years ago

DiceBear Avatars - Code Sprite Collection

license npm

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/api/code/: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

previewurl
https://avatars.dicebear.com/api/code/example.svg
https://avatars.dicebear.com/api/code/example.svg?options[padding]=1&options[background]=%23f0f0f0

NPM

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

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

Now you are ready to create your first Avatar.

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

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

Options

namealiastypedefaultdescription
radiusrnumber0Avatar border radius
base64boolfalseReturn avatar as base64 data uri instead of XML Not supported by the HTTP API
widthwnumbernullFixed width
heighthnumbernullFixed height
marginmnumber0Avatar margin in percent HTTP-API limitation Max value 25
backgroundbstringnullAny valid color identifier HTTP-API limitation Only hex (3-digit, 6-digit and 8-digit) values are allowed. Use url encoded hash: %23.
userAgentstringwindow.navigator.userAgentUser-Agent for legacy browser fallback Automatically detected by the HTTP API
typestringqrCurrently only "qr" is supported
colorstringnullAny valid color identifier HTTP-API limitation Only hex (3-digit, 6-digit and 8-digit) values are allowed. Use url encoded hash: %23.
correctionLevelstringMChoose from L, M, Q, H

Further information

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

"QR Code" is a registered trademark of DENSO WAVE INCORPORATED.

4.2.5

4 years ago

4.2.3

4 years ago

4.2.1

4 years ago

4.2.0

4 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.1.0-alpha.0

4 years ago

4.0.8

4 years ago

4.0.5

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

1.0.0

4 years ago