Generate Github-style Identicon Avatars With Squares – Squareicon

Category: Javascript | December 4, 2019
Author: mistic100
Views Total: 887 views
Official Page: Go to website
Last Update: December 4, 2019
License: MIT


Generate Github-style Identicon Avatars With Squares – Squareicon


Yet another avatar generator that generates Github-like identicons using squares to representing hash values.

Works both on browser and node.js.

See also:

How to use it:

Install and download the package.

$ npm install squareicon --save

Import the main JavaScript file into the document.

<script src="browser.js"></script>

Include the randomcolor library for color schemes.

<script src="[email protected]/randomColor.min.js"></script>

Include the spark-md5 library for the fast md5 implementation.

<script src="[email protected]/spark-md5.min.js"></script>

Create an empty img tag to hold the identicon.

<img id="squareicon"></div>

Generate a basic identicon from an ID you provide.

  id: 'cssscript', 
  hasher: SparkMD5.hash
}, (err, data) => {
  document.querySelector('img').src = data;

Customize the identicon with the following options.

  d: null,
  hasher: md5,
  colors: 2,
  pixels: 8,
  size: 128,
  padding: 0,
  symmetry: 'none',
  scheme: 'standard',
  background: 'transparent'



  • v1.0.3

You Might Be Interested In:

Leave a Reply