Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

favicons

Package Overview
Dependencies
Maintainers
3
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

favicons

Favicon generator for Node.js

  • 7.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is favicons?

The favicons npm package is a tool for generating favicons and other related icons for web applications. It simplifies the process of creating various sizes and types of icons required for different devices and platforms.

What are favicons's main functionalities?

Generate Favicons

This feature allows you to generate favicons from a source image. The configuration object can be customized to specify different settings, and the callback function handles the generated icons, files, and HTML elements.

const favicons = require('favicons');
const source = 'path/to/logo.png';
const configuration = { /* configuration options */ };
const callback = (error, response) => {
  if (error) {
    console.log(error.message);
    return;
  }
  console.log(response.images); // Array of { name: string, contents: <buffer> }
  console.log(response.files); // Array of { name: string, contents: <string> }
  console.log(response.html); // Array of strings (html elements)
};
favicons(source, configuration, callback);

Custom Configuration

This feature allows you to customize the configuration for generating favicons. You can specify various options such as the application name, description, background color, theme color, and more. The icons object allows you to enable or disable the creation of specific types of icons.

const favicons = require('favicons');
const source = 'path/to/logo.png';
const configuration = {
  path: '/assets/icons', // Path for overriding default icons path
  appName: 'My App', // Your application's name
  appShortName: 'App', // Your application's short name
  appDescription: 'This is my application', // Your application's description
  developerName: 'Developer', // Your (or your developer's) name
  developerURL: 'http://example.com', // Your (or your developer's) URL
  background: '#020307', // Background color for flattened icons
  theme_color: '#020307', // Theme color for browser chrome
  display: 'standalone', // Android display: 'browser' or 'standalone'
  orientation: 'portrait', // Android orientation: 'portrait' or 'landscape'
  start_url: '/?homescreen=1', // Start URL when launching the application from a device
  version: '1.0', // Your application's version string
  logging: false, // Print logs to console?
  pixel_art: false, // Keeps pixels 'sharp' when scaling up, for pixel art
  loadManifestWithCredentials: false, // Browsers only
  icons: {
    android: true, // Create Android homescreen icon. `boolean` or `{ offset, background }`
    appleIcon: true, // Create Apple touch icons. `boolean` or `{ offset, background }`
    appleStartup: true, // Create Apple startup images. `boolean` or `{ offset, background }`
    coast: { offset: 25 }, // Create Opera Coast icon with offset 25%. `boolean` or `{ offset, background }`
    favicons: true, // Create regular favicons. `boolean`
    firefox: true, // Create Firefox OS icons. `boolean` or `{ offset, background }`
    windows: true, // Create Windows 8 tile icons. `boolean` or `{ background }`
    yandex: true // Create Yandex browser icon. `boolean` or `{ background }`
  }
};
const callback = (error, response) => {
  if (error) {
    console.log(error.message);
    return;
  }
  console.log(response.images); // Array of { name: string, contents: <buffer> }
  console.log(response.files); // Array of { name: string, contents: <string> }
  console.log(response.html); // Array of strings (html elements)
};
favicons(source, configuration, callback);

Other packages similar to favicons

Keywords

FAQs

Package last updated on 15 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc