Create SVG identicons in Elixir with IdenticonSvg

Create SVG identicons in Elixir with IdenticonSvg

20 February, 2023 1 min read
software, programming, Elixir, open source, UI

Another week, another Elixir package – my “Year of Elixir” continues!

Identicons are useful as placeholders, such as for profile pictures.

One other use of identicons I have found over the past few months is to use them as visual differentiators of item listings.

This is especially useful when many records in a listing share lots of information.

By attaching a unique, unchanging, visually distinct marker to each record (be it a div in a flexgrid or a table row), UX can be improved by speeding up the visual identification and recall of of single records within lists.

There already were various Elixir libraries for generating identicons, as this task lends itself as a great exercise in Elixir topics such as structs, pipes, maps, lists, the Enum module, and using Erlang’s modules (here, :crypto and :binary).

However, I needed a library that generates identicons as SVG code, so that I can dynamically generate and inline identicons on my Phonenix app’s HTML views through assigns.

The result is IdenticonSvg .