Skip to content

visualizevalue/avvatars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

avvatars

npm GitHub

A tiny library for generating geometric avatars as SVGs.

Install

npm install avvatars
pnpm add avvatars
yarn add avvatars

Usage

import { avvatar, avvatarDataUri } from 'avvatars'

// Generate an avatar from an Ethereum address
const svg = avvatar({
  seed: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
})

// Use as img src
const dataUri = avvatarDataUri({ seed: '0x...' })

Options

Option Type Default Description
seed string random Seed string (e.g., Ethereum address, ENS name)
size number 100 Output size in pixels
gridSize number 5 Grid resolution (4-8 recommended)
foreground string #000000 Foreground color
background string #ffffff Background color
padding number 0.15 Padding ratio (0-1)
symmetric boolean true Mirror pattern horizontally
optimized boolean false Use path rendering for smaller files

Examples

// Basic
avvatar({ seed: '0x...' })

// Larger grid
avvatar({ seed: '0x...', gridSize: 8 })

// Inverted colors
avvatar({
  seed: '0x...',
  foreground: '#ffffff',
  background: '#000000'
})

// Custom size with no padding
avvatar({
  seed: '0x...',
  size: 256,
  padding: 0
})

License

WTFPL

About

A tiny library for generating geometric avatars as SVGs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors