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

my-avatars

v1.0.1

Published

Generate unique avatars of off your own image files!

Downloads

6

Readme

my-avatars

Generate unique avatars of off your own image files!

Docs

  • Item
    • new Item(path, opts)
      • path is the path to the image
      • opts
        • x: Number - x-coord to place the image
        • y: Number - y-coord to place the image
        • check: Boolean - check if the image can be found - required to replace-colors
        • replace: Array of Object's - filled with colors to replace from and to
          • from: String - color to replace from, in the format of r,g,b - e.g. 128,128,128
          • to: String - color to replace to, in the format of r,g,b - e.g. 128,128,128
  • Layer
    • new Layer(name, idx)
      • name: String - a friendly name to recognise
      • idx: Number - the z-index of the layer
  • Generator
    • new Generator(width, height, parentElm)
      • width: Number - width of the avatar
      • height: Number - height of the avatar
      • parentElm: Element - element to place avatar within

Usage

Installing

First install my-avatars by running npm i my-avatars

Import

Now you'll need to import { Generator, Layer, Item } from my-avatars in your js-file.

Building

To build the generator, you'll have to have some images at hand. These should be made into Item's, by new Item('./images/face.png').

Next, we'll need a Layer: new Layer('faces', 0), this layer should have a name - for your own convenience - and an id, which can correspond to the z-index in css.

NB: No two layers can't have the same index.

Next-up, we'll need to pass in all of the Item's, like so: faceLayer.addItem(item).

Generator

Now for the magical part, the Generator. Start by creating a new Generator, by new Generator(400, 400, app). Whereas the first 400 is the width of the avatar, next is the height and last argument is the parent element of, to which the avatar-canvas should be injected.

If all of this doesn't make sense. Check out the example

Example

Check main.js, to run the example use npm run dev. Or read this article