LXMFace/README.md
2026-04-15 21:58:26 -06:00

2.4 KiB

LXMFace

Deterministic visual identities for LXMF / Reticulum addresses

License: MIT Rust JavaScript Status: Stable


LXMFace identicons generated from different LXMF addresses

LXMFace gives every LXMF address a unique, recognizable face. The same address always produces the same avatar — across any app that uses LXMFace.

It works like the original blockies: feed in an address hash, get back a deterministic symmetrical identicon. No server, no image files, no lookups. The output is a self-contained SVG string.

Available as a Rust crate and a JavaScript library. Both produce identical output, validated by shared test vectors.

Usage

Rust

[dependencies]
lxmface = "0.1"
use lxmface::lxmface_svg;

// Generate an SVG string from an LXMF address hash
let svg = lxmface_svg("a7b3c9d1e5f20681943ab2de77fc8e01", 64);

Zero runtime dependencies. no_std compatible (requires alloc).

If you need the raw colors and grid for custom rendering (native canvas, terminal, pixel buffer):

let data = lxmface::lxmface_data("a7b3c9d1e5f20681943ab2de77fc8e01");
// data.color, data.bgcolor, data.spotcolor — HslColor { h, s, l }
// data.grid — [[u8; 8]; 8], where 0=bg, 1=primary, 2=spot

JavaScript

<script src="lxmface.js"></script>
<script>
  document.getElementById('avatar').innerHTML = lxmface('a7b3c9d1e5f20681943ab2de77fc8e01', 64);
</script>

Also works as an ES module or CommonJS require. Single file, no build step, no dependencies.

How It Works

The input hash seeds a Xorshift128 PRNG, which generates three HSL colors and an 8x8 symmetric grid. Each cell maps to one of the three colors. The grid is rendered as SVG rectangles inside a circular clip path.

Same hash, same PRNG sequence, same colors, same grid, same avatar. Every time.

License

MIT