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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@opeepsfun/avatar-illustration-system

v1.0.3

Published

npm package of avatar illustration system

Downloads

27

Readme

@opeepsfun/avatar-illustration-system

npm license

Description

Introducing the @opeepsfun/avatar-illustration-system, a pure JavaScript npm package that powers the avatar illustration system. This package provides an API to create unique, hand-drawn avatar illustrations which can be used in a myriad of applications such as user profiles, product illustrations, or any creative project you envision. No external libraries are required, making it a seamless addition to any project, irrespective of the tech stack.

The illustrations are designed by Micah Lanier. Explore the beautiful artwork and get inspired!

Try It Out

You can delve into the creative world of avatars by heading to the official builder. Explore and interact with various options to create personalized avatars, get a hands-on experience, and see all the features in action.

For a live React example, check out this CodeSandbox demo.

Installation

Getting started is a breeze. Install the package via npm with the following command:

npm install @opeepsfun/avatar-illustration-system

Usage

Here's a simplistic example to kickstart your creativity:

import { Avatar } from "@opeepsfun/avatar-illustration-system";

const avatar = Avatar({
    circle: { backgroundColor: "brown" },
    size: 600,
    glasses: "Square",
    ear: "Attached",
    eye: "Round",
    shirt: "Crew"
});

const parser = new DOMParser();
const svgDOM = parser.parseFromString(avatar, "image/svg+xml");

document.getElementById("illustration").appendChild(svgDOM.documentElement);

In this snippet, we import the Avatar module, configure the avatar properties, parse the generated SVG string into a DOM element, and append it to a designated HTML element.

Features

  1. Pure JavaScript:

    • Being a pure JavaScript library, it can effortlessly integrate with any project, regardless of the underlying libraries or frameworks.
  2. Vast Customization:

    • From facial features to clothing, a broad spectrum of customizable options allows for the creation of unique avatars.
  3. Dynamic Rendering:

    • The system dynamically renders SVG elements based on the specified properties, ensuring optimal performance and versatility.
  4. Seamless Integration:

    • The package is designed for easy integration into existing projects, with no additional dependencies required.
  5. SVG Output:

    • The avatars are generated as SVG elements, ensuring crisp visuals and scalability across devices.

Components and Props

The Avatar function accepts an object with the following properties:

  • size: Required. Specifies the size of the avatar.
  • circle: Optional. An object specifying background color of a circular mask.
  • ear: Optional. Specifies the type of ears.
  • mouth: Optional. Specifies the type of mouth.
  • nose: Optional. Specifies the type of nose.
  • glasses: Optional. Specifies the type of glasses.
  • eyebrow: Optional. Specifies the type of eyebrows.
  • eye: Optional. Specifies the type of eyes.
  • shirt: Optional. Specifies the type of shirt.
  • top: Optional. Specifies the type of top.

Here's a Markdown table for the Avatar component props:

| Prop | Type | Description | | --- | --- | --- | | size | number | The size of the avatar. | | circle | { backgroundColor?: string; } | Optional. The background color of the circle around the avatar. | | ear | "Attached", "Detached" | Optional. The type of ear. Default is "Detached". | | mouth | "Laughing", "Frown", "Nervous", "Pucker", "Sad", "Smile", "Smirk", "Surprised" | Optional. The type of mouth. Default is "Laughing". | | nose | "Round", "Pointed", "Curved" | Optional. The type of nose. Default is "Round". | | glasses | "Round", "Square" | Optional. The type of glasses. | | eyebrow | "Up", "Down", "EyelashesDown", "EyelashesUp" | Optional. The type of eyebrow. Default is "Up". | | eye | "Smiling", "Ellipse", "EllipseShadow", "Round" | Optional. The type of eye. Default is "Smiling". | | shirt | "Collared", "Crew", "Tee" | Optional. The type of shirt. Default is "Collared". | | top | "MisterT", "Fonze", "Full", "Bald", "Doug", "Phantom", "Turban", "Pixie" | Optional. The type of top. Default is "Fonze". | | color | { outlineColor?: string; skinColor?: string; topColor?: string; shirtColor?: string; collarColor?: string; glassFrameColor?: string; } | outlineColor: Optional. The color of the avatar's outline. Default is "#171921".skinColor: Optional. The color of the avatar's skin. Default is "#AC6651".topColor: Optional. The color of the avatar's top.shirtColor: Optional. The color of the avatar's shirt.collarColor: Optional. The color of the avatar's collar.glassFrameColor: Optional. The color of the avatar's glasses frame. |

Build

To build the project, run:

npm run build

Contributing

If you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.

License

MIT

Author