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

colorio

v0.1.3

Published

Pick colors from the screen on macOS in Node or Electron.js applications

Downloads

15

Readme

colorio

colorio is a color picker(eyedropper) GUI tool, implemented as a node.js module with a native macOS binary that represents GUI layer. It can be used in any stand-alone node.js or Electron.js applications running on macOS.

demo

Installation

$ npm install colorio

Requires macOS 10.12 or later.

Demo

A minimalistic Electron based demo can be found by the following url:

Features

  • Multiple displays support
  • Retina displays support
  • No dependencies
  • Tiny binary -> 59 kb
  • Electron integraion out of the box

Usage

const pickColor = require('colorio').pickColor;

pickColor().then((res) => {
    console.log(res);
    //=> on color pick
    // {
    //     "result": "picked",
    //     "color": {
    //         "r": 0.2980392156862745,
    //         "g": 0.6078431372549019,
    //         "b": 0.2980392156862745
    //     }
    // }    

    //=> on hitting `Esc` key
    // {
    //     "result": "canceled",
    // }    
});

NOTE: In Electrion applications this function should be called from the main process.

API

pickColor([options]) => Promise

Executes native binary file and returns a Promise for the result.

Fullfills when user picks color from the screen or aborts the action by hitting Esc key.

options

execPath

Type: string Default: undefined

A custom path to the colorio's binary. Might be helpful in case of custom dev environment setup using webpack. If not set, path is resolved automatically based on __dirname with respect to app.asar.unpacked in case module is used in an Electron app.

Returns

Returns a promise with an object when promise is fullfilled. In case color is picked, the object will look like this, where color property contains r, g, b keys representing rgb color components in 0...1 range (0.0 -> 0, 1.0 => 255):

{
    "result": "picked",
    "color": {
        "r": 0.2980392156862745,
        "g": 0.6078431372549019,
        "b": 0.2980392156862745
    }
}  

In case user cancels the action by hitting Esc key, the resulting object's result's key value will be set to canceled:

{
    "result": "canceled"
}  

Color Management

Currently colorio doesn't support custom color spaces. Picked colors are converted via genericRGBColorSpace, thus the resulting colors might be a bit different from color pickers in other apps.

Maintainers

License

MIT