This library contains the main identicon function as well as a bonus simpleHash function.
Hash function used by Minidenticons. Based on the FNV1a hash algorithm, modified for signed 32 bit integers. Always return a positive integer.
simpleHash "alienHead66" -- 39870209603664160
Generate the SVG identicon.
The
identiconfunction will return a SVG element generated from its username string argument. The saturation and lightness arguments have to be percentages, i.e integers between 0 and 100.For instance for the username "alienHead66", with a saturation of 75% and a lightness of 50%:
You will get the following identicon (without the border):
Note that the picture above is resized. By default identicons will take all the space available.
The white space around the colored squares is here to allow uncropped circle avatars like the ones you can see in the demo.
Play with the demo to find a combination of saturation and lightness that matches your website theme colors: light, dark, pastel or whatever 😎