npm.io
0.1.0-alpha.1 • Published 4h ago

@ensdomains/etherloom

Licence
MIT
Version
0.1.0-alpha.1
Deps
0
Size
16 kB
Vulns
0
Weekly
0

etherloom

Deterministic SVG weave patterns from an Ethereum address. The same (address, pattern, color) always renders the same image, and different addresses render different images — so it works as an on-chain identicon/avatar.

  • The address picks the pattern; the color is a parameter you pass and never changes the structure (recolor any address freely).
  • 18 named weaves, two render styles: tiles (default, icon look — two-tone rounded squares on a soft frame) and threads (dense fabric).
  • Effectively unique per address: every tile's shade and opacity is address-driven, so even the simplest weave differs address-to-address (0 collisions measured across millions of addresses).

Usage

import {
  generatePattern,
  generatePatternDataURI,
  generateAllPatterns,
  listPatterns,
} from "./etherloom";

// color is required (#RGB or #RRGGBB)
generatePattern("0xd8dA…6045", "Herringbone", "#f03090");

// options: backgroundColor, style ("tiles" | "threads"), width, height, cellSize
generatePattern("0xd8dA…6045", "2-2 Twill", "#3366cc", { width: 240, height: 240, cellSize: 24 });
generatePattern("0xd8dA…6045", "Herringbone", "#f03090", { style: "threads" });

generateAllPatterns("0xd8dA…6045", "#2e9e5b");                     // all 18 as SVG
generatePatternDataURI("0xd8dA…6045", "Basket Weave", "#ff9800"); // data: URI for <img>

Scripts

npm install
npm test         # node:test suite
npm run demo     # console demo
npm run gallery  # write gallery.html and open it  (optional:  -- 0xAddr "#color")

Interactive demo

docs/ is a static page: enter an Ethereum address or ENS name (resolved with viem) and a color to see all 18 patterns live. Build and serve it locally:

npm run build:web
python3 -m http.server -d docs 8000   # then open http://localhost:8000

Patterns

Matt Rib Irregular · ENS Vertical Pairs · Plain Weave · Warp Rib Regular · Weft Rib Regular · Satin Weave · Houndstooth · Sateen Weave · Royal Oxford · 2-2 Twill · 3-3 Twill · Weft Rib Irregular · Warp Rib Irregular · Basket Weave · Point Twill · Curtain · Herringbone · 738 Diagonal Plus

License

MIT ENS Labs

Keywords