@avatar-generator/core
v3.1.0
Published
Generate deterministic SVG avatars from any seed, in eleven styles, with no runtime dependencies
Readme
@avatar-generator/core
Core engine for @avatar-generator:
deterministic SVG avatar generation. The same seed always produces byte-identical
output.
This package holds createAvatar, the seeded random generator and the SVG
helpers. It renders nothing on its own — pair it with a style package.
Install
npm install @avatar-generator/core @avatar-generator/style-initialsUsage
import { createAvatar } from "@avatar-generator/core";
import { initials } from "@avatar-generator/style-initials";
const avatar = createAvatar(initials, {
seed: "[email protected]",
size: 64,
});
img.src = avatar.toDataUri();Types
Core declares only the style contract — AvatarOptions, Style, Random and
AvatarResult. Each style's own option type comes from that style's package:
import { faces, type FacesOptions } from "@avatar-generator/style-faces";In 2.x these types lived here; they moved in 3.0.0 so a style published by anyone can be typed. See the migration guide.
Styles
@avatar-generator/style-initials, @avatar-generator/style-geometric, @avatar-generator/style-pixels, @avatar-generator/style-rings, @avatar-generator/style-faces, @avatar-generator/style-illustrated, @avatar-generator/style-anime, @avatar-generator/style-abstract, @avatar-generator/style-emoji, @avatar-generator/style-animals, @avatar-generator/style-gradient
Framework wrappers
@avatar-generator/react, @avatar-generator/vue, @avatar-generator/svelte, @avatar-generator/angular, @avatar-generator/web-component
Documentation
Full documentation: avatar-generator.hugoogb.dev
License
MIT © Hugo García Benjumea
