Deterministic address identicons — the classic 8×8 "blockies" every wallet renders, in pure Elm.
Faithful port of the canonical ethereum/blockies algorithm (xorshift PRNG
seeded from the lowercased address, three HSL colors, 8-wide vertically
mirrored grid), so the identicon for an address here matches the one users
already recognise from MetaMask et al. Recognition is the whole point of an
identicon — a pretty-but-different avatar would be worse than none.
Identicon.view [] { size = 24 } holderAddressRendered as an inline SVG (viewBox 0 0 8 8, crisp edges) so it scales
losslessly to any size. The three colors are data — derived from the
address — so they are set as SVG fill attributes; everything else
(border-radius for circular crops, borders, drop shadows) belongs to your
CSS via the web3-identicon class.
.web3-identicon { border-radius: 50%; } /* circular crop */CSS class: web3-identicon.
Compute the colors and grid for any seed string (normally the lowercase
0x… address — view handles that for you). Deterministic: the
same seed always yields the same Cells.
The raw material of an identicon, for custom renderers (canvas, PNG
export): three CSS color strings and the 64-cell grid in row-major order.
Cell values: 0 background, 1 color, 2 spot color.
Render the identicon for an address at a given pixel size.
The
attrsland on anHtml.spanwrapper (classweb3-identicon), not on the SVG itself —Html.Attributes.classsets theclassNameproperty, which is read-only on SVG nodes and would crash at runtime. The wrapper makes anyHtml.Attributesafe to pass.