IdenticonSvg v0.9.2 released, now with padding and much smaller SVG output

IdenticonSvg v0.9.2 released, now with padding and much smaller SVG output

14 June, 2024 •1 min read
software, programming, Elixir, identicons

Thanks to some prodding by ku1ik on the Elixir Forum thread of IdenticonSvg , I put in some effort to implement three features that were long missing:

  1. Automatic background color: you can now pass the argument :basic for basic color complementarity, :split1 for the first option of split complementarity, or :split2 for the second one. Passing nil sets the background to transparent, as before.

  2. Padding: you can now pass an integer argument for the padding width, in terms of “blocks”. So, if size is 5 and padding is 1, the total size of the resulting SVG file is 7x7 blocks.

  3. File size reduction: the resulting SVG files are now much smaller, as the naive array of foreground and background <rect> elements is replaced by a <path> with the content of its d attribute written in a compact manner. The background results from a mask. The output is now typically way less than one kilobyte.

The result is v0.9.2 on Hex .