Geometric avatars as SVGs. Generate unique identicons from any seed string — Ethereum addresses, ENS names, emails, usernames. Deterministic, customizable, lightweight.
5
200px
15%
Installation
npm install avvatarsUsage
import { avvatar } from 'avvatars'
const svg = avvatar({
seed: 'visualizevalue',
size: 200,
gridSize: 5,
foreground: '#000000',
background: '#ffffff',
padding: 0.15,
symmetric: true,
optimized: false,
})API Reference
avvatar(options?)
Generates an avatar SVG from a seed string. Returns SVG markup as a string.
| Parameter | Type | Default | Description |
|---|---|---|---|
| seed | string | random | Deterministic input (addresses, ENS, emails) |
| size | number | 100 | Output dimensions in pixels |
| gridSize | number | 5 | Grid resolution (4-8 recommended) |
| foreground | string | #000000 | Primary shape color |
| background | string | #ffffff | Canvas color |
| padding | number | 0.15 | Inner margin ratio (0-1) |
| symmetric | boolean | true | Horizontal mirror effect |
| optimized | boolean | false | Path-based rendering for smaller file size |
avvatarDataUri(options?)
Returns the avatar as a base64-encoded data URI. Same parameters as avvatar(). Use directly in <img src>.