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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@usespaceui/avatars

v0.1.4

Published

A dynamic, code-driven SVG avatar generator for React applications.

Readme


✨ Overview

@usespaceui/avatars is a free, zero-dependency React library that generates beautiful, deterministic SVG avatars. The same seed always produces the same avatar, with no stored images and no network calls.


🌐 HTTP API Live Demo

You can generate avatars without installing anything by using the free REST API endpoint. It supports svg, png, webp and json outputs.

<!-- Clean URL Route -->
<img src="https://avatars.spaceui.one/v1/pebble/orion.svg" alt="Orion" />

<!-- Query Parameters Route -->
<img src="https://avatars.spaceui.one/v1?name=jupiter&variant=lumina&format=webp" alt="Jupiter" />

📦 Installation

pnpm add @usespaceui/avatars
# or
npm install @usespaceui/avatars
# or
yarn add @usespaceui/avatars

Zero dependencies.


🚀 Usage

React Component

import { Avatar, AvatarVariant } from '@usespaceui/avatars'

export default function Demo() {
  return <Avatar name="Sirius" variant={AvatarVariant.triton} size={64} circle animate />
}

Set animate={false} whenever motion should be disabled for a specific context.

Core API (Framework-agnostic)

You can generate the raw SVG markup or JSON data directly for server environments or vanilla JS:

import { createAvatar, AvatarOutputFormat } from '@usespaceui/avatars'

// Generate raw SVG string
const svg = createAvatar({ name: 'sirius', variant: 'gradient', size: 256 })

// Generate JSON metadata and structured data
const avatarJson = createAvatar({
  name: 'vega',
  variant: 'pebble',
  format: AvatarOutputFormat.json,
})

name is the deterministic identity. createAvatar() and <Avatar /> use the stable default name when it is omitted or empty. A variant can be an individual style or a family name: gradient/gradients, fluid/fluids, classic/classics, or paletteless.


⚙️ React Props

| Prop | Type | Default | Description | | ----------- | ------------------------------------------ | ------------ | ------------------------------------------------------------------------ | | name | string | "Space UI" | Deterministic avatar identity seed. | | variant | AvatarVariant | AvatarFamily | "all" | "pebble" | The visual family / style of the avatar, or "all" for a random deterministic variant across all styles. | | size | number | 64 | Rendered size in pixels. | | circle | boolean | false | If true, clips the avatar to a full circle (otherwise a full rectangle). | | colors | [string, string, string, string, string] | – | Exactly 5 colors to use. If omitted, a harmonious palette is generated. | | effect | AvatarEffect | "none" | Optional post-processing effect (none or noise). | | animate | boolean | false | Whether to animate the avatar. | | className | string | – | Optional CSS class applied to the wrapper span element. |

Note: Custom palettes must contain exactly five hexadecimal colors. Unsupported effects and animation combinations are safely disabled in the returned output metadata.


🧰 Utilities Included

  • createAvatar(options: CreateAvatarOptions): string | AvatarJson Core deterministic generation engine. Takes a configuration object (name, variant, colors, etc.) and returns either an SVG string or a structured JSON object.

  • resolveVariant(name: string, variant?: string): AvatarVariant Safely resolves a generic family name (e.g. "classics", "gradients"), "all", or any variant string into a concrete AvatarVariant.

  • getContrast(hexColor: string): '#000000' | '#ffffff' Determines whether a dark (#000000) or light (#ffffff) foreground provides optimal contrast against any background hex color using standard YIQ perceived luminance.

  • getAvatarDetails(variant: AvatarVariant): AvatarDetails Retrieves capabilities metadata (e.g. if it supports animation or custom colors) for a specific variant.

  • getAllAvatarDetails(): AvatarDetails[] Returns metadata for all available variants.

  • getFamilyVariants(family: AvatarFamily): AvatarVariant[] Groups and returns all variants belonging to a specific family or "all".

  • isAnimateActive(variant: AvatarVariant, animate?: boolean): boolean Helper to check if motion is allowed, returning false if the variant doesn't support animation.


📦 Related Packages

| Package | Description | | ---------------------------------------------------------------- | ---------------------------------------------- | | @usespaceui/sounds | UI sound effects and audio interactions | | @usespaceui/squircle | Figma-style corner smoothing (Apple squircles) |


🪪 License

MIT — Free for commercial and personal use.


📚 Resources


🛠 Maintenance

If you find a bug or have a feature request, please open an issue on GitHub. Engine internals are intentionally not part of the public API.