Generate Github-style Identicon Avatars With Squares – Squareicon

Category: Javascript | December 31, 2022
Views Total:424 views
Official Page:Go to website
Last Update:December 31, 2022


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>

Create an empty img tag to hold the identicon.

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

Generate a basic identicon from an ID you provide.

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

Customize the identicon with the following options.

  d: null,
  hasher: sha1,
  colors: 2,
  pixels: 8,
  size: 128,
  padding: 0,
  symmetry: 'none', // none, vertical, horizontal, central
  scheme: 'standard', // raw, standard, light, bright, dark
  background: 'transparent'


v2.0.0 (12/31/2022)

  • squareicon function now returns a Promise when not called with a callback
  • the default hash algorithm is now SHA1 and uses native implementations (md5 dependency is removed)

You Might Be Interested In:

Leave a Reply