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 🙏

© 2024 – Pkg Stats / Ryan Hefner

colormatch

v0.0.5

Published

A module for extracting colors from images and for generating lookup ranges that accept rgb and outputs ranges of rgb values for db lookups. Right now it uses ImageMagik in a child process to reduce the colorspace and return the top colors of an image. Al

Downloads

36

Readme

build status

ColorMatch

Ever want to compare colors? ever want to extract colors from images? You can extract the dominant colors in an image with my extract.imageMagick function. (more libs comming soon) You can use a matching algo that uses simple range math. Simple is nice!

If you index those colors in a system that has efficient range queries the output of the rgbRange function will be distinct r,g,b ranges that match visually

API

####matching api

  • quickMatch(rgb1,rgb2) do these colors match? this shows the logic required to use the provided rgb ranges and is useful for quick matching colors. rgb1 and rgb2 should be arrays with at least 3 int values in the format of [red,green,blue]

  • rgbRange(r,g,b) this takes 3 arguments reg,green, and blue. it expects them to be ints. it returns an object. this object has keys r1,g1,b1 and r2,b2,g2 defined {r1:0,r2:0,g1:0,g2:0,b1:0,b2:0} to use this data all values in r between r1 and r2 are valid matches the same follows for g and b

  • ColorMatch(options) this is the core object for color match right now. The only reason you would want to make a new colormatch instance is to adjust the fuzzy tollerance applied to colors. It is set to 15 points in the rgb space by default

####extracting api

all values are nested under the main export .extract the behavior of color extraction is to:

  1. reduce the colorspace in an image down to 16 colors
  2. output how much of the image is that color.
  3. output the data in a consistent format

example output:

[{ percent: 9.996918248611745e-37, rgb: [ '70', '72', '62' ] }]

supported extractors

  • imageMagick(path,callback) this shells out to convert (a part of the imageMagick suite) if you dont have it installed it wont work.

####desired extractors

node-canvas js only png js only jpeg