npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

pinecone-avatars

v0.2.0

Published

A customizable React avatar picker library with 60+ unique combinations

Readme

pinecone-avatars

A customizable React avatar picker library with 60+ unique combinations. Generate fun, SVG-based avatars with different backgrounds, skin tones, hairstyles, expressions, and outfits.

npm license bundle size

Preview

Live Demo

Features

  • 8 background colors
  • 1 skin tone
  • 27 hairstyles
  • 13 expressions
  • 9 t-shirt colors
  • Fully typed with TypeScript
  • Export to SVG, Base64, or PNG
  • Zero dependencies (only React peer dep)
  • Works with Next.js, Vite, Create React App

Framework Compatibility

| Framework | Support | |-----------|---------| | Next.js (App Router) | Full support | | Next.js (Pages Router) | Full support | | Vite + React | Full support | | Create React App | Full support | | Remix | Full support |

Note: generatePngBase64(), downloadSvg(), and downloadPng() require browser environment. In Next.js, call these only on the client side.

Installation

npm install pinecone-avatars
yarn add pinecone-avatars
pnpm add pinecone-avatars
bun add pinecone-avatars

Quick Start

import { Avatar } from 'pinecone-avatars';

function App() {
  return <Avatar size={200} />;
}

Usage

Basic Avatar

import { Avatar } from 'pinecone-avatars';

<Avatar size={200} />

Custom Avatar

import { Avatar } from 'pinecone-avatars';

<Avatar
  size={200}
  background="babyBlue"
  skin="softPeach"
  tshirt="orange"
  expression="happy"
  hair="shortBuzz"
/>

Random Avatar

import { Avatar, generateRandomConfig } from 'pinecone-avatars';

<Avatar {...generateRandomConfig()} size={200} />

Avatar Picker Component

Interactive UI for selecting avatar options:

import { AvatarPicker } from 'pinecone-avatars';

function App() {
  const handleChange = (config) => {
    console.log('Avatar config:', config);
  };

  return <AvatarPicker onChange={handleChange} />;
}

Export Avatar

import {
  generateSvg,
  generateBase64,
  generatePngBase64,
  downloadSvg,
  downloadPng
} from 'pinecone-avatars';

const config = {
  background: 'babyBlue',
  skin: 'softPeach',
  tshirt: 'orange',
  expression: 'happy',
  hair: 'shortBuzz'
};

// Get full SVG string
const svgString = generateSvg(config);

// Get base64 SVG data URL
const base64Svg = generateBase64(config);

// Use in img tag
<img src={generateBase64(config)} alt="avatar" />

// Get base64 PNG (browser only)
const base64Png = await generatePngBase64(config, 512);

// Download as SVG file (browser only)
downloadSvg(config, 'my-avatar.svg');

// Download as PNG file (browser only)
await downloadPng(config, 512, 'my-avatar.png');

Next.js Example

// app/page.tsx (App Router)
import { Avatar, generateRandomConfig } from 'pinecone-avatars';

export default function Page() {
  return <Avatar {...generateRandomConfig()} size={200} />;
}
// app/picker/page.tsx (App Router - AvatarPicker works directly, has "use client" built-in)
import { AvatarPicker } from 'pinecone-avatars';

export default function PickerPage() {
  return <AvatarPicker onChange={(config) => console.log(config)} />;
}
// Client-side export (App Router)
"use client";

import { downloadPng } from 'pinecone-avatars';

export function DownloadButton({ config }) {
  return (
    <button onClick={() => downloadPng(config, 512, 'avatar.png')}>
      Download PNG
    </button>
  );
}

API Reference

<Avatar />

| Prop | Type | Default | Description | |------|------|---------|-------------| | size | number | 200 | Avatar size in pixels | | background | BackgroundType | 'babyBlue' | Background color | | skin | SkinType | 'softPeach' | Skin tone | | tshirt | TshirtType | 'orange' | T-shirt color | | expression | ExpressionType | 'happy' | Facial expression | | hair | HairType | 'shortBuzz' | Hairstyle | | className | string | - | CSS class name | | style | CSSProperties | - | Inline styles |

<AvatarPicker />

| Prop | Type | Description | |------|------|-------------| | value | AvatarConfig | Controlled value | | onChange | (config: AvatarConfig) => void | Change callback | | className | string | CSS class name |

Functions

| Function | Description | |----------|-------------| | generateRandomConfig() | Returns a random AvatarConfig | | generateSvg(config?, size?) | Returns SVG string | | generateBase64(config?, size?) | Returns base64 SVG data URL | | generatePngBase64(config?, size?) | Returns base64 PNG data URL (async, browser only) | | downloadSvg(config?, filename?) | Downloads SVG file (browser only) | | downloadPng(config?, size?, filename?) | Downloads PNG file (async, browser only) |

Available Options

Background (BackgroundType)

babyBlue | coralRed | darkGray | lightGray | mintGreen | pastelGreen | peach | softPink

Skin (SkinType)

softPeach

T-Shirt (TshirtType)

amber | blue | charcoal | green | orange | pink | raspberry | white | yellow

Expression (ExpressionType)

angry | focused | furious | happy | laughing | sad | shocked | sideGlance | sleepy | starry | suspicious | tired | worried

Hair (HairType)

afroPuffs | asymmetricBuns | bob | bobSidePart | bowlCut | braids | bunnyEars | curlyHeadband | curlyMessy | curlyPigtails | curlyPuff | fullCurly | longAfro | longPeak | longStraight | messyArtistic | pigtailBuns | shortBuns | shortBuzz | shortCurly | sideBangs | spaceBuns | spikyEarmuffs | tinyBun | topKnot | wavyCenterPart | wavyPuffs

TypeScript

Full TypeScript support with exported types:

import type {
  AvatarConfig,
  AvatarProps,
  AvatarPickerProps,
  BackgroundType,
  SkinType,
  TshirtType,
  ExpressionType,
  HairType
} from 'pinecone-avatars';

Constants

Access all available options as arrays:

import {
  BACKGROUNDS,
  SKINS,
  TSHIRTS,
  EXPRESSIONS,
  HAIRS
} from 'pinecone-avatars';

console.log(BACKGROUNDS); // ['babyBlue', 'coralRed', ...]
console.log(HAIRS);       // ['afroPuffs', 'asymmetricBuns', ...]

About

Built with love by Pinecone - A software development company based in Mongolia.

License

MIT