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

simple-color-converter

v2.1.13

Published

This is a simple colors converter, works for almost any color. Has a built in color identifier for converting strings to color. Supported convert colors: from and to CMYK, grayscale, hex3, hex4, hex6, hex8, html, hsl, hsv, lab, pantone, ral, rgb, rgba, rg

Downloads

2,752

Readme

build passing License maintained Vulnerabilities Node Version NPM size NPM size Release Commit Issues Total downloads

Simple color converter for (almost) Any Color

DEMO

It covers most colors formats from Pantone, Ral, Hex 3/4/6/8, HTML, sRgb, CMYK, etc for converting from -> and -< to. It's designed with simplicity in mind. you can pass data and specify the format or just let is guess what color you are trying to pass as string.

simple color convertor logo

Install

$ npm install simple-color-converter

Usage

const simpleColorConverter = require('simple-color-converter');

var color = new simpleColorConverter({
    ral: { ral: 3009 }, 
    to: 'cmyk'
})

console.log(color) // { c: 0, m: 53, y: 60, k: 60 } 

Supported colors

Expected input value list [here].

Expected output value list [here].

| color system | object | array | string | | --- | --- | --- | --- | | cmyk | {c: 39, m: 0, y: 39, k: 7} | [39, 0, 39.7] | 'cmyk 39 0 39 7' | grayscale | | | '78' | | hex3 | | | '#9E9' | | hex4 | | | '#9E9F' | | hex6 | | | '#90EE90' | | hex8 | | | '#90EE90FF' | | html | | | 'Light Green' | | hsl | { h: 120, s: 73.4, l: 74.9 } | [120, 73.4, 74.9] | 'hsl 120 73.4 74.9' | | hsv | { h: 120, s: 39.4, l: 93.3 } | [120, 39.4, 93.3] | 'hsl 120 39.4 93.3' | | lab | {l: 86.5, a: -46.3, b: 36.9} | [86.5, -46.3, 36.9] | 'lab 86.5 -46.3 36.9' | | pantone | {name: '358C'} | | 'pantone 358C' | | ral | { ral : 6019 } | | 'ral 6019'| | rgb | { r: 144, g: 238, b: 144 } | [144, 238, 144] | 'rgb 144 238 144'| | rgba | { r: 144, g: 238, b: 144, a: 1 } | [144, 238, 144, 1] | 'rgba 144 238 144 1'| | rgb decimal | | | 'rgb decimal 6812065' | | w | { r: 144, g: 238, b: 144, a: 1 } | [144, 238, 144, 1] | 'w 544' | | xyz | { x: 44, y: 69, z: 45 } | [44, 69, 45] | 'xyz 44 69 45' | | yuv | { y: 180, u: 113.2, v: 73.5 } | [ 180, 113.2, 73.5 ] | 'yuv 180 113.2 73.5' |

From

Any of the colors mentioned above. You can specify the color and it will be faster of just use the built in color detector.


// faster
var fasterColor = new simpleColorConverter({
    rgb: {r: 10, g: 200, b: 50}, 
    to: 'cmyk'
})

// slower but more convenient

var slowerColor = new simpleColorConverter({
    color: 'rgb 10 200 50', 
    to: 'cmyk'
})

| Extra From colors | note | | --- | --- | | color | Autoidentify color | | hex | Autoidentify hex color | | android | hex8 |

Flags

flags are the arguments used for special modifiers. The most useful one is rendering grayscale color, but there is a debugger and a hexref flag created if you need to convert a color but also output a close hex similar color(in case of online color convertors).

const simpleColorConverter = require('simple-color-converter');

var color = simpleColorConverter({
    hex3: '#228', 
    to: 'cmyk', 
    grayscale: true 
})

console.log(color) // { c: 0, m: 0, y: 0, k: 87 }

| flag | output | data type | default | note | | --- | --- | --- | --- | --- | | grayscale | grayscale value in the from format | boolean | false | | | hexref | Reference value in hex format | boolean | false | For Hex it equels Hex6 | | debug | this prevents the object cleanup | boolean | false | |

Future

I am working on version 3 or this package and the new version will be a modern setter and getter based color convertor. A much modern way of approaching this problem.

Contribute

If there are any features you would like to support, or want to add it directly please send us a pull request. I`m more then happy.

If you have any suggestions or you spotted an aberrant behavior or bugs, don't hesitate to send me an email.

License

Copyright © 2019, Radu Dragan. Licensed under the MIT License.

Thank you

I`m Radu, Thank you for using my color convertor, I hope it is useful for you. I genuinely excited to build this kind of solutions.