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 🙏

© 2025 – Pkg Stats / Ryan Hefner

color-sucker

v1.4.1

Published

Color Sucker is a Node.js script that extracts color palettes from images in a specified folder. It supports multiple image formats, including `.jpg`, `.jpeg`, `.png`, and `.gif`. For `.gif` files, it extracts frames, combines them into a single image, an

Downloads

10

Readme

Color Sucker

Color Sucker is a Node.js script that extracts color palettes from images in a specified folder. It supports multiple image formats, including .jpg, .jpeg, .png, and .gif. For .gif files, it extracts frames, combines them into a single image, and extracts the palette from the combined image.

Quick Start

Will extract color palettes from images in the current directory and save them to ./output/palettes.json:

npx color-sucker

name colors and convert them to multile formats:

npx color-sucker && npx palette-aldente ./output/palettes.json --formats name,rgb,hsl --namelist bestOf 

Features

  • Extracts color palettes from images.
  • Supports .jpg, .jpeg, .png, and .gif formats.
  • Combines frames from .gif files into a single image for palette extraction.
  • Configurable via sucker.config.js.
  • Parallel processing with configurable thread limits.

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd color-sucker
  2. Install dependencies:

    npm install

Configuration

Edit the sucker.config.js file to customize the script:

  • imagesFolder: Path to the folder containing images (relative to the project root).
  • outputFolder: Path to the folder where results will be saved (relative to the project root).
  • outputJson: Filename for the JSON output containing extracted palettes (will be placed in outputFolder).
  • outputHtml: Filename for the HTML report (will be placed in outputFolder). If defined, an HTML report will be generated.
  • paletteSize: Number of colors to extract from each image.
  • maxGifFrames: Maximum number of frames to extract from GIFs (set to null for all frames).
  • maxThreads: Maximum number of threads for parallel processing.

Usage

There are two main ways to run Color Sucker:

1. Using npm (after cloning the repository)

If you have cloned the repository and installed dependencies:

npm start

This method uses the sucker.config.js file located within the cloned repository.

2. Using npx (recommended for quick use without cloning)

You can run Color Sucker directly in any directory using npx:

npx color-sucker

To specify the number of colors to extract, use the --colors or -c flag:

npx color-sucker --colors 10
# or
npx color-sucker -c 3

To generate an HTML report showing the images and their extracted palettes, use the --report html flag:

npx color-sucker --report html

You can combine both flags:

npx color-sucker --colors 8 --report html

These flags will override the corresponding settings in any sucker.config.js or the default values.

Behavior with npx:

  • With sucker.config.js: If a sucker.config.js file is present in the directory where you run npx color-sucker, that configuration will be used (unless overridden by CLI flags like --colors).
  • Without sucker.config.js: If no sucker.config.js is found in the current directory:
    • The script will look for images in the current directory (. or process.cwd()).
    • The output folder will be set to ./output within the current directory.
    • The output files will be saved using the default filenames (palettes.json and report.html if HTML report generation is enabled).
    • Default values for paletteSize, maxGifFrames, and maxThreads from the script's internal default configuration will be used.

This makes it easy to quickly extract palettes from images in any folder without needing to clone the repository or manage a global installation.

Dependencies

Output

The extracted palettes are saved in the JSON file specified in sucker.config.js (default: output/palettes.json). Each entry includes the image name and its extracted colors.

License

This project is licensed under the MIT License.