New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

iconic

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iconic

Tools for SVG icons

  • 0.2.21
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
45
increased by4.65%
Maintainers
1
Weekly downloads
 
Created
Source

Maintenance Maintaner Website shields.io made-with-Markdown made-for-VSCode GitHub license Profile views GitHub contributors GitHub issues

GitHub forks GitHub stars GitHub watchers GitHub followers

iconic

Tools for SVG icons

Installation

npm install iconic

Using

CLI

iconic --output=bundle.js --element=ui-icon icons/*

Node

Compiling client script:

const iconic = require('iconic');

// Bundles all icons and renders script with webcomponent named 'ui-icon' definition
let bundle = iconic.bundle('ui-icon', {
  icon1: svg,
  icon2: svg,
  icon3: svg,
});

Using icons:

<script src="/path/to/bundle.js"></script>

<h1>
  <i><ui-icon name="icon1" /></i>
  <span>Iconic</span>
</h1>

API

Iconic

const iconic = require('iconic');

// Bundles all icons and renders script with webcomponent named 'ui-icon' definition
let bundle = iconic.bundle('ui-icon', {
  icon1: svg,
  icon2: svg,
  icon3: svg,
});

// Bundles all files in directory
let bundle = iconic.directoryBundle('ui-icon', dirname);

// Creating icon
let icon = iconic.createIcon(source, name);

Icon

const iconic = require('iconic');

let icon = iconic.createIcon(source, name);

// Is icon colored
icon.isColored();

// Get [width, height] size
icon.getSize();

icon
  // Set monocolored icon color
  .setColor('#ff0000')
  // Resize icon
  .resize(100, 100)
  // Clear SVG code
  .clear()
  // Clear, optimize and set width and height to 100
  .normalize()
  // Write icon to file
  .save('icon.svg');

// Export as PNG
icon.toPNG().then(data => fs.writeFileSync('icon.png', data));

// Export as JPEG
icon.toJPEG(backgroundColor).then(data => fs.writeFileSync('icon.jpeg', data));

Pack

const iconic = require('iconic');

let pack = new iconic.Pack();

// Add instance of Icon to pack
pack.addIcon(icon);

// Returns plain object with icon names as keys and svg code as values
pack.toJSON();

// Creates script with icons and webcomponent to display icons
pack.bundle((elementName = 'ui-icon'));

// Is pack contains colored icons
pack.isColored();

DevPlugins

  • ooi;

Keywords

FAQs

Package last updated on 17 May 2021

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