v0.2.0

BrickAvatars

Deterministic LEGO-style avatar generator. Same seed, same face. 1k+ combinations, SVG-first.

$npm install @brick-avatars/core
1k+Combinations
256SVG base

12 avatars each generated from a unique string seed

Interactive

Try It Live

Type any string, name, email, or ID and get a deterministic avatar instantly.

Try:alicebobyou@company.comuser_4242hello world

Generated palette

skin
hair
accent
background

Slot selections

eyes
variant 5on
mouth
variant 1on
facialHair
variant 0off
freckles
variant 7on
glasses
variant 0off
hair
variant 0off

"ahmed"

Usage

import { generateAvatar } from "@brick-avatars/core";

const { svg, palette, selections } =
  generateAvatar({
    seed: "ahmed",
  });

SVG output

<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256">
<rect width="256" height="256" fill="#FFFFFF" rx="12"/>
<path d="M83.1206 24.0515C83.1206 19.5277 86.7879 15.8604 91.3118 15.8604H161.346C165.87 15.8604 169.538 19.5277 169.538 24.0515V49.0346H83.1206V24.0515Z" f
Why Brick Avatars

Everything you need

A complete avatar system designed for production use — from a single function call to a full HTTP API.

Core

Deterministic

Same seed always produces the same avatar. No randomness at render time — perfect for user profiles, consistent IDs, and reproducible tests.

Format

SVG-First

Pure SVG output with a 256×256 viewBox. Scales to any resolution with zero pixelation. Embed inline, use in an <img>, or serve as a file.

Performance

Zero Dependencies

The entire core package has no runtime dependencies. Tiny bundle footprint. Works in Node, Bun, Deno, Cloudflare Workers, and the browser.

Architecture

Modular Slots

Eyes and mouth are always on; optional hair, facial hair, glasses, and freckles. Each slot is independently hashed. Adding new variants never changes existing avatars. Extend with your own components.

Variety

Hundreds of combinations

Sets of eyes, mouths, hair, facial hair, glasses, and freckles. Every combination feels distinct and recognizable.

Runtime

Truly Isomorphic

One API across all JS runtimes. Import in the browser, run in a Worker, call from a CLI, or integrate into an HTTP API — identical output everywhere. (Soon)

Usage

Dead simple API

One function. Three deployment targets. Zero configuration.

generate-avatar.ts
import { generateAvatar } from "@brick-avatars/core";

// Basic usage
const { svg, palette, selections } = generateAvatar({
  seed: "ahmed",
});

// Set it as innerHTML
document.getElementById("avatar").innerHTML = svg;

// Custom size (scales the SVG)
const big = generateAvatar({ seed: "ahmed", size: 256 });

// Override palette colors
const custom = generateAvatar({
  seed: "ahmed",
  palette: { hair: "#3B82F6", accent: "#EF4444" },
});