Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@dicebear/avatars-male-sprites

4.2.1 • Public • Published

DiceBear Avatars - Male 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/male/: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/api/male/example.svg
https://avatars.dicebear.com/api/male/example.svg?options[mood][]=happy
https://avatars.dicebear.com/api/male/example.svg?options[mood][]=sad

NPM

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

npm install --save @dicebear/avatars @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');

Options

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
mood array of strings ['happy', 'sad', 'surprised'] Possible values: sad, happy, surprised

Further information

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


Inspired by 8biticon (Copyright 2012 Plastic Jam - MIT Licensed)

Install

npm i @dicebear/avatars-male-sprites

DownloadsWeekly Downloads

184

Version

4.2.1

License

MIT

Unpacked Size

33.9 kB

Total Files

6

Last publish

Collaborators

  • avatar