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

colorio

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colorio

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

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

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:

  • colorio-electron-example

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

Keywords

FAQs

Package last updated on 04 Dec 2018

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