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

@tdrmk/avatarmaker

v1.0.12

Published

generate random avatar images

Downloads

6

Readme

Avatar Maker

Generate random avatar images (in SVG format).

Inspired from Free Avatar Maker.

Installation

# Using yarn
yarn add @tdrmk/avatarmaker

# Using npm
npm install @tdrmk/avatarmaker

CDN Links

<script src="https://unpkg.com/@tdrmk/avatarmaker/dist/index.js" defer></script>
<script>
  window.addEventListener("DOMContentLoaded", () => {
    const { svg } = window.AvatarMaker.generateAvatar();
    document.querySelector("#avatar").innerHTML = svg;
  });
</script>

Usage

Generate a random image (gender chosen at random).

const { generateAvatar } = require("@tdrmk/avatarmaker");

// generate a random avatar
const { svg } = generateAvatar();

// logs the svg image
console.log(svg);

Generate a random image with specified gender (male or female).

const { generateAvatar } = require("@tdrmk/avatarmaker");

// generate a random male avatar
const { svg } = generateAvatar({ gender: "male" });

// logs the svg image
console.log(svg);

Obtain features from generated image

const { generateAvatar } = require("@tdrmk/avatarmaker");

// generate a random avatar
const { svg, chosen_zones } = generateAvatar();

// logs the chosen features
console.log(chosen_zones);

// logs the svg image
console.log(svg);

Generate an image with specified features

const { generateAvatar } = require("@tdrmk/avatarmaker");

const chosen_zones = {
  backs: 7,
  clothes: 1,
  ears: 3,
  faceshape: 9,
  mouth: 14,
  eyesiris: 5,
  eyesfront: 8,
  eyebrows: 3,
  nose: 1,
};

// generate a random avatar
const { svg } = generateAvatar({ gender: "male", chosen_zones });

// logs the svg image
console.log(svg);

All available features

const chosen_zones = {
  backs: 1,
  hairback: 13,
  humanbody: 0,
  chinshadow: 5,
  clothes: 11,
  ears: 6,
  faceshape: 11,
  mouth: 13,
  eyesback: 2,
  eyesiris: 7,
  eyesfront: 0,
  facehighlight: 0,
  eyebrows: 10,
  nose: 2,
  beard: 8,
  mustache: 11,
  hairfront: 13,
  glasses: 2,
};

Using Avatar ID

const { generateAvatar } = require("@tdrmk/avatarmaker");
// generate a random avatar
const { avatarId, svg } = generateAvatar({ gender: "male" });
// Ex: avatarId = '1012136229674839'

// some other code ...

// later on regenerate same avatar, use the unique avatar id
const { svg } = generateAvatar({ avatarId });

Generating random avatar images


npx avatarmake > output.svg

Sample images

Some randomly generated images

Sample male 1 Sample male 2 Sample male 3 Sample male 4 Sample male 5 Sample male 6 Sample male 7 Sample male 8 Sample male 9 Sample male 10 Sample male 11 Sample male 12 Sample male 13 Sample male 14 Sample male 15 Sample male 16 Sample male 17 Sample male 18

Sample female 1 Sample female 2 Sample female 3 Sample female 4 Sample female 5 Sample female 6 Sample female 7 Sample female 8 Sample female 9 Sample female 10 Sample female 11 Sample female 12 Sample female 13 Sample female 14 Sample female 15 Sample female 16 Sample female 17 Sample female 18