JavaScript API

Below is the Jdenticon interface described. In most cases the HTML attributes are enough for using Jdenticon. Check them out before reading the rest of the API.

Html attributes

Attributedata-jdenticon-valueSpecified on a <canvas> or <svg> element to declare that an identicon should be rendered for this value within the element.
Attributedata-jdenticon-hashSpecified on a <canvas> or <svg> element to declare that an identicon should be rendered for this hexadecimal hash string within the element.

Methods

Methodjdenticon()Updates all <canvas> or <svg> elements with the data-jdenticon-value or data-jdenticon-hash attribute.
Methodjdenticon.update()Updates the identicon in a specific DOM element or for all elements matching a CSS selector.
Methodjdenticon.updateCanvas()Updates the identicon in a specific <canvas> element or for all elements matching a CSS selector.
Methodjdenticon.updateSvg()Updates the identicon in a specific <svg> element or for all elements matching a CSS selector.
Methodjdenticon.drawIcon()Renders an indenticon on a HTML canvas.
Methodjdenticon.toPng()Renders an identicon as a PNG image. Not available in the browser.
Methodjdenticon.toSvg()Renders an identicon as a SVG image.
Methodjdenticon.configure()Configures the appearance of generated icons and the behavior of Jdenticon.
Method$.fn.jdenticon()jQuery wrapper plugin for updating all identicons in a query element collection.

Global variables

Propertyjdenticon_configConfigures the appearance of generated icons and the behavior of Jdenticon.

Command line

Jdenticon comes with a command line interface that allows you to generate identicons with no programming required.

Command line usage Install scopes

Troubleshooting

A common problem is that no icons are rendered. Try one of the solutions in this article to solve the problem.