agenticon
v0.0.2-alpha
Published
Deterministic geometric identicons — crisp SVG for the web and ANSI block-glyph art for the terminal, from one shared generator.
Downloads
312
Maintainers
Readme
agenticon
Deterministic geometric identicons. One generator, two views: crisp SVG for the web and ANSI block-glyph art for the terminal.
Each icon is a 4×2 grid of cells (solids, halves, corner blocks, diagonals, corner triangles) grown so adjacent cells share colour across their seams. Tiles are chosen so no quarter-square is ever left orphaned, giving a continuous, legible flow. An optional recolour pass remaps the icon onto a small bold OKLCH palette (on by default). Output is a pure function of the input string — same text, same icon, everywhere.
Install
npm install agenticonLibrary
import { agenticon, agenticonDataURI, agenticonAnsi } from "agenticon";
agenticon("[email protected]"); // -> <svg>…</svg> (recoloured)
agenticon("[email protected]", { recolor: false, size: 48 }); // raw 16-colour flow
agenticon("[email protected]", { bw: true }); // -> 1-bit black-and-white SVG
agenticon("[email protected]", { gray: true }); // -> greyscale SVG
agenticonDataURI("[email protected]"); // -> data:image/svg+xml,… for <img src>
agenticonAnsi("[email protected]"); // -> two lines of ANSI block glyphs
agenticonAnsi("[email protected]", { scale: 2 }); // -> each tile as a 2×2 block of glyphs
agenticonAnsi("[email protected]", { bw: true }); // -> glyphs only, NO colour codes (terminal fg/bg)
// React: <img src={agenticonDataURI(user.email)} alt="" width={48} height={48} />Options:
| option | default | applies to | meaning |
|-------------|--------------|------------|----------------------------------------------------|
| recolor | true | both | remap onto the bold palette; false = raw flow |
| bw | false | both | 1-bit black-and-white; in the terminal emits no colour codes (glyphs only, your terminal's fg/bg) |
| gray | false | both | greyscale (luma ramp); bw wins if both set |
| size | 64 | SVG | width/height in px |
| mode | truecolor | ANSI | "256" for 8-bit terminals |
| canonical | true | ANSI | false emits literal glyphs (no fg/bg-swap fold) |
| scale | 1 | ANSI | tile size multiplier — each tile fills scale² glyphs |
Also exported: generate(text) (the raw cells[row][col] grid), buildRecolorMap,
buildGrayMap, buildBwMap, makeRng, PALETTE.
CLI
agenticon [email protected] # terminal icon
agenticon --tile-size 2 alice # bigger: each tile becomes a 2×2 glyph block
agenticon --bw alice # 1-bit B&W; terminal output is glyphs only (no colour codes)
agenticon --gray alice # greyscale
agenticon --gallery # a sample set
agenticon --svg [email protected] # emit SVG to stdout
agenticon --svg --bw alice # black-and-white SVG
agenticon --size 128 alice # SVG at 128px (--size implies --svg)
agenticon alice --no-recolor --256 # raw flow, 8-bit colourRun agenticon --help for all flags.
License
MIT
