I bet you've seen these avatars in forums before...
StackOverflow | GitHub | Wordpress | etc
A generated user icon pattern
that is unique to each user
(if iframe is allowed..?)
Show me the pattern!
Corners + Edges + Center
+
Colour
A set of potential patterns to use to create the icon
16 Tiles in JavaScript
What info can we use
to generate the unique 22 bits?
The username!
Convert the username to a bit hash
using Javascript
Use the hash to pick characteristics
Use the characteristics to create the icon
& Render them to the HTML 5 Canvas
var node = document.querySelector('canvas'); var ctx = node.getContext("2d"); // Setup the default paintbrush and save ctx.fillStyle = "white"; ctx.save(); // Restore Point // paint background white ctx.fillRect(x, y, size, size); // Setup the coloured paintbrush ctx.fillStyle = "fuchsia"; // Draw Patch ctx.beginPath(); ctx.moveTo(x,y); ctx.lineTo(x,y); ... for all coordinates of the shape ... ctx.closePath(); ctx.fill(); //draw to screen ctx.restore(); // Restore back to white
Your identicon!
A generated user icon pattern