Node.js CLI tool to generate a set of favicons from a single input file.

Overview

npm

This is a simple CLI tool to generate an optimized set of favicons from a single input file. Icons are optimized in terms of both size and quantity (nowadays you don't need that many of them). They are produced according to this article which served as an inspiration for the tool.

Use it like this: npx favgen /path/to/input -o /path/to/output.

You can tweak the following settings by giving additional commands:

  • output directory by providing -o option with a path (__favicon__ by default)
  • icon prefix by providing --prefix option with a name (favicon by default)
  • colors palette size by providing --colors with a number between 2 and 256
  • producing 16x16 .ico file by setting --include16 flag

Input file can be in any of the following formats: JPEG, PNG, WebP, GIF, AVIF, TIFF or SVG (anything sharp library accepts).

By default, the following set of favicons is produced:

  • favicon.svg if input file was SVG and favicon.png 32x32 otherwise
  • favicon.ico 32x32
  • favicon-192.png 192x192 (for Android devices)
  • favicon-512.png 192x192 (for Android devices)
  • apple-touch-icon.png 180x180 (original image is resized to 140x140 and 20px transparent padding is added on each side; rationale for this is given in the article)

Additionally, a sample manifest.webmanifest file is produced which shows how favicons for Android devices are supposed to be included.

Besides that, PNG output is optimized by sharp (which uses pngquant) and SVG output is optimized by SVGO. Also, color palette is reduced to 64 colors by default in order to reduce assets’ size.

The tool can be also used as API:

const { produceIcons } = require("favgen")
const inputFilePath = "favicon.svg"
const outputDirPath = "__favicons__"
const prefix = "favicon" // default value
const paletteSize = 64 // default value
const include16 = true // default is false
produceIcons(inputFilePath, outputDirPath, prefix, paletteSize, include16)
You might also like...

Distributed, realtime CLI for live Node apps.

Distributed, realtime CLI for live Node apps.

Vantage = CLI + SSH + REPL for your live node app. In one line: require("vantage")().listen(4000); What just happened? That's voodoo magic: show me th

Dec 30, 2022

download torrents with node from the CLI

download torrents with node from the CLI

torrent Download torrents from the command line usage torrent magnet link OR path to .torrent file Download a torrent from a magnet link to torre

Dec 26, 2022

Node.js Open CLI Framework. Built with 💜 by Heroku.

Node.js Open CLI Framework. Built with 💜 by Heroku.

oclif: Node.JS Open CLI Framework 🗒 Description 🚀 Getting Started Tutorial ✨ Features 📌 Requirements 🌈 CLI Types 🏗 Usage 📚 Examples 🔨 Commands

Jan 4, 2023

A Node.js CLI to download PDF invoices from Stripe.

A Node.js CLI to download PDF invoices from Stripe.

Feb 13, 2022

SFDX Plugin to set Email Deliverability Access Level for an org easily and quickly via command line interface

SFDX Plugin to set Email Deliverability Access Level for an org easily and quickly via command line interface

Dec 16, 2022

Infinite Red's cutting edge React Native project boilerplate, along with a CLI, component/model generators, and more!

Infinite Red's cutting edge React Native project boilerplate, along with a CLI, component/model generators, and more!

Ignite - the hottest React Native boilerplate Battle-tested React Native boilerplate The culmination of five years of constant React Native developmen

Dec 29, 2022

Test your internet connection speed and ping using speedtest.net from the CLI

Test your internet connection speed and ping using speedtest.net from the CLI

speed-test Test your internet connection speed and ping using speedtest.net from the CLI Install Ensure you have Node.js version 8+ installed. Then ru

Jan 7, 2023

:white_square_button: WhatsApp chat from commandline/console/cli using GoogleChrome puppeteer

:white_square_button: WhatsApp chat from commandline/console/cli using GoogleChrome puppeteer

Whatspup Use Whatsapp from commandline/console/cli using GoogleChrome puppeteer! 😄 Features ✅ Send and receive messages ✅ Read Receipts ✅ Switch betw

Dec 1, 2022

:notes: Control iTunes via CLI

:notes: Control iTunes via CLI

itunes-remote Control iTunes via your terminal 🎶 Using JXA via osascript via Node.js. Requirements Node.js (v0.12.7 or greater) Mac OS X (Yosemite 10

Nov 19, 2022
Comments
  • Issue with creating .ico files

    Issue with creating .ico files

    I have an issue with the creation of the .ico file. The created file looks like this: favicon

    Generated .png files are looking good. Any idea how to debug to identify the reaseon?

    opened by danielkoch 4
Owner
null
LinkFree CLI is a command line tool that helps you to create your LinkFree profile through CLI.

LinkFree CLI LinkFree CLI is a command line tool that helps you to create your LinkFree profile through CLI. Demo Using the CLI (Commands) Note First

Pradumna Saraf 32 Dec 26, 2022
A cli tool to generate random mock data from OpenAPI definition for msw.

msw-auto-mock A cli tool to generate random mock data from OpenAPI descriptions for msw. Why We already have all the type definitions from OpenAPI spe

null 76 Dec 15, 2022
Generate a Node.js command line tool from an OpenAPI definition

OpenAPI Commander Generate a Node.js command line tool from an OpenAPI definition using the commander library. Example usage Usage: Subcommands groupe

Barry Coughlan 12 Jan 3, 2023
Pretty diff to html javascript cli (diff2html-cli)

diff2html-cli Diff to Html generates pretty HTML diffs from unified and git diff output in your terminal Table of Contents Features Online Example Dis

Rodrigo Fernandes 404 Dec 19, 2022
A CLI for peer-to-peer file sharing using the Hypercore Protocol.

A CLI for peer-to-peer file sharing (and more) using the Hypercore Protocol.

Hypercore Protocol 207 Dec 30, 2022
CLI tool for running Yeoman generators

yo What's Yeoman? Yeoman helps you to kickstart new projects, prescribing best practices and tools to help you stay productive. To do so, we provide a

Yeoman 3.6k Dec 30, 2022
A simple CLI tool to create and manage xhelpers-api projects

A simple CLI tool to create and manage xhelpers-api projects

null 2 Feb 25, 2022
DataENV is a cli tool that allows you to save data temporarily using your terminal.

DataEnv CLI Instllation npm install -g dataenv Usage Table of Contents LocalStorage npx dataenv save Parameters npx dataenv show Parameters npx dataen

PGamerX 2 Feb 5, 2022
A CLI tool for project Pigeon.

Pigeon CLI [Incubating] A CLI tool for project Pigeon. Getting Start Download if you have node.js installed upon you machine, you can install pigeon-c

Pigeon 2 Feb 18, 2022
A CLI tool that allows you to ensure a database is live before closing the process

Wait for a database to be available prior to launching subsequent commands. ??⌛

Rida F'kih 3 Apr 16, 2022