duyet / identicon.js

GitHub-style identicons in JS with no server-side processing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

identicon.js

GitHub-style identicons in JS with no server-side processing.

This little library will produce the same shape and (roughly) the same color as GitHub when given the same hash value. Note that GitHub uses an internal database identifier for the hash, so you can't simply md5 the username and get the same result. The hard work is done by Robert Eisele's PNGlib. The creative visual design is borrowed from Jason Long of Git and GitHub fame.

Demo

View Demo

Usage

// base64 encoded PNG
var data = new Identicon(hash, 420).toString();

// write to a data URI
document.write('<img width=420 height=420 src="data:image/png;base64,' + data + '">');

Requires PNGLib

Copyright 2013, Stewart Lord
Released under the BSD license

About

GitHub-style identicons in JS with no server-side processing.

License:BSD 2-Clause "Simplified" License


Languages

Language:JavaScript 93.9%Language:HTML 6.1%