Generate unique, beautiful SVG avatars from any string. Deterministic output — same seed always gives the same avatar.
Tweak parameters, preview at multiple sizes, copy config or SVG.
Works with any JS runtime — Node, Deno, Bun, browsers.
npm install dither-avatar
bun add dither-avatar
yarn add dither-avatar
Small, fast, and framework-agnostic.
No runtime deps. Pure TypeScript. Tiny bundle. Works everywhere.
Same seed always produces the same avatar. Perfect for user identifiers, keys, or any unique string.
Generates crisp SVG markup or a data URI. Scales to any size without pixelation.
Hue is derived from the seed hash. Every avatar gets a distinct color pair automatically.
4×4 ordered dithering creates a stylized halftone pattern from a linear density gradient.
Optional <DitherAvatar> and <DitherAvatarSVG> components via dither-avatar/react.
Core API — framework agnostic.
// Core (any JS runtime) import { generateDitherAvatar, ditherAvatarDataUri } from 'dither-avatar'; // Get raw SVG string const svg = generateDitherAvatar('alice'); // Get data URI for <img src> const uri = ditherAvatarDataUri('alice');
React components.
// React (optional) import { DitherAvatar } from 'dither-avatar/react'; function UserProfile({ username }) { return <DitherAvatar seed={username} size={48} />; }
Custom styles.
<DitherAvatar seed="bob" size={64} className="ring-2 ring-white" style={{ borderRadius: '12px' }} />