Skip to content
Avatars generator
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
LICENSE
README.md
package.json
preview.png
ucavatar.js

README.md

Ucavatar.js

version-badge npm-downloads license-badge

Unique avatars for your users. No dependencies. 1.6KB gzipped.

Preview of Ucavatar

Installation

From NPM

npm install --save ucavatar
var Ucavatar = require('ucavatar');

Or you can copy it into your project and use a script tag

<script src='ucavatar.js'></script>

Also you can use CDN:

<script src='https://unpkg.com/ucavatar/ucavatar.js'></script>

Examples

At first, you need a canvas:

<canvas id='avatar'></canvas>

You can generate an avatar with the following code:

Ucavatar('#avatar', 'name, nickname or email')

Or pass canvas itself:

Ucavatar(document.querySelector('#avatar'), 'name')

By default size of an avatar is 64x64, but you can specify a custom one:

Ucavatar('#avatar', 'name', 128)

Enjoy it!

You can’t perform that action at this time.