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

font-awesome-icon-generator

v0.0.2-beta1

Published

Create small .png icons from a font-awesome 4.7 icon

Downloads

8

Readme

font-awesome-icon-generator: Generating icons from font-awesome

Use case: You want to create an icon for your app and are lazy. Pick a font-awesome icon and a color and be done with it.

Pick an icon

Visit https://fontawesome.com/v4/icons/ and pick an icon. It has to be from v4, as that is the last version with an open license, so it can be distributed in npm. (Patches welcome to support later versions.)

Let us say you picked fa-binoculars from https://fontawesome.com/v4/icon/binoculars . Congratulations!

Notice how that page also shows the Unicode hex value: f1e5:

fa-binoculars screenshot

Pick a color

Google has a color picker: https://www.google.com/search?q=color+picker

Lets say you picked #962456 as the color, because magenta binoculars are cool. Congratulations!

Install it

$ npm install font-awesome-icon-maker

Create the configuration and go

import fontAwesomeIconGenerator from 'font-awesome-icon-generator'

const config = {
  iconOutputFile: (size) => `bino-icon-${size}.png`,
  unicodeHex: 'f1e5',
  color: '#962456',
  // // These defaults can be omitted
  // sizes: [16, 32, 48, 64, 128, 256, 512],
  // mirrorX: false,
  // mirrorY: false,
}

fontAwesomeIconGenerator(config)

This will create these files:

bino-icon-16.png
bino-icon-32.png
bino-icon-48.png
bino-icon-64.png
bino-icon-128.png
bino-icon-256.png
bino-icon-512.png

That's it.

Optional extra - create favicon(s)

Now, what I do is to create a favicon from bino-icon-512.png using https://www.npmjs.com/package/favicons as documented on https://github.com/itgalaxy/favicons.

This is not part of this project, but is mentioned here as a natural next step.

I usually only need the single favicon.ico and generate it like this:

import favicons from "favicons";
import fs from "fs/promises";

const src = "./bino-icon-512.png";
const faviconFileName = "favicon.ico"

const response = await favicons(src, { path: "/never-used-but-needs-a-value"});
const faviconImage = response.images.filter(i => i.name == faviconFileName)[0]
await fs.writeFile(faviconFileName, faviconImage.contents)

But read the favicons documentation for many more options, now that you have the icons.