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 🙏

© 2026 – Pkg Stats / Ryan Hefner

icns-generator

v1.1.1

Published

A simple and easy-to-use macOS application icon (.icns) generator

Readme

ICNS 图标生成器

一个简单易用的跨平台应用图标生成工具,可以将各种格式的图片转换为带圆角的应用图标。

特性

  • ✨ 自动生成所有需要的图标尺寸
  • 🎨 自动添加 macOS 风格的圆角(20% 圆角)
  • 🖼️ 支持多种图片格式(PNG、JPG、WEBP、SVG、GIF 等)
  • 🛠️ 支持命令行使用
  • 📦 简单易用,零配置
  • 🌍 跨平台支持(Windows、macOS、Linux)
  • 🪟 自动生成 Windows ICO 文件
  • 🍎 macOS 上自动生成 ICNS 文件(需要 iconutil)

系统要求

  • Node.js 14.0.0 或更高版本
  • macOS 系统生成 .icns 文件需要 iconutil 命令(Xcode Command Line Tools)
  • Windows 和 Linux 系统可生成 PNG 图标集和 .ico 文件

安装

全局安装

# 使用 npm
npm install -g icns-generator

# 使用 pnpm(推荐)
pnpm add -g icns-generator

本地安装

# 克隆仓库
git clone https://github.com/CatKeee/icns-generator.git
cd icns-generator

# 安装依赖
pnpm install

# 链接到全局
pnpm link --global

使用方法

命令行使用

# 基本用法(在当前目录下查找 icon.png 并生成 icon.icns)
icns-generator

# 指定输入文件
icns-generator --input my-icon.jpg

# 指定输出文件
icns-generator --output app-icon.icns

# 查看支持的文件格式
icns-generator --list-formats

# 完整参数
icns-generator --input my-icon.png --output app-icon.icns --dir temp.iconset --output-dir icons --padding 10 --work-dir /path/to/project

参数说明

  • -i, --input <path>: 输入图片路径(默认: icon.png
  • -o, --output <path>: 输出 ICNS 文件路径(默认: icon.icns
  • -d, --dir <path>: 临时 iconset 目录名称(默认: icon.iconset
  • -O, --output-dir <path>: 所有生成文件的输出目录(默认: output
  • -p, --padding <percent>: 图标四周的留白区域百分比(默认: 8.75
  • -w, --work-dir <path>: 工作目录(默认: 当前目录)
  • --list-formats: 显示支持的文件格式
  • -v, --version: 显示版本号
  • -h, --help: 显示帮助信息

在代码中使用

import { generateIcons, generateIcns, generateIco } from "icns-generator";

// 推荐:使用跨平台方法(自动适配当前系统)
// - 所有平台:生成 PNG 图标集 + .ico 文件
// - macOS(有 iconutil):额外生成 .icns 文件
const result = await generateIcons({
  inputFile: "my-icon.png",
  outputDir: "icons",
  padding: 10,
});
console.log(result); // { iconset, icons, ico, icns }

// 仅生成 ICO 文件(所有平台)
await generateIco({
  inputFile: "my-icon.png",
  outputIco: "app-icon.ico",
  outputDir: "icons",
});

// 仅生成 ICNS 文件(仅 macOS,需要 iconutil)
await generateIcns({
  inputFile: "my-icon.png",
  outputIcns: "app-icon.icns",
  iconsetDir: "temp.iconset",
  outputDir: "icons",
  padding: 10,
  workDir: "/path/to/project",
});

开发

安装依赖

pnpm install

本地测试

# 直接运行
node src/index.js

# 或者通过 CLI 运行
node bin/cli.js

许可证

MIT