Nostalgic Primordial Monster
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

color2code

0.1.0 • Public • Published

color2code

NPM Version License Github Issues Travis Status Coveralls

Get color code from color name

Features

This module converts a colorname to hex & rgb from CLI or from a Node.js application.

CLI Install

npm install color2code --global

Usage

You can pass in the color name to get it's hex & rgb values.

$ color2code rebeccapurple

will output

{
    "name": "rebeccapurple",
    "hex": "#663399",
    "rgb": "rgb(102, 51, 153)"
}

You can also pass in multiple colors to their hex & rgb values

$ color2code rebeccapurple thistle sandybrown

will output

[
    {
        "name": "rebeccapurple",
        "hex": "#663399",
        "rgb": "rgb(102, 51, 153)"
    },
    {
        "name": "thistle",
        "hex": "#d8bfd8",
        "rgb": "rgb(216, 191, 216)"
    },
    {
        "name": "sandybrown",
        "hex": "#f4a460",
        "rgb": "rgb(244, 164, 96)"
    }
]

Node app

Install the module locally

$ npm install color2code --save

Update index.js as below

const C2C = require('color2code').default;
console.log(C2C('red green orange'));

Run

$ node index.js
{ name: 'red', hex: '#f00', rgb: 'rgb(255, 0, 0)' },
  { name: 'green', hex: '#008000', rgb: 'rgb(0, 128, 0)' },
  { name: 'orange', hex: '#ffa500', rgb: 'rgb(255, 165, 0)' } ]

Author

Arvind Ravulavaru arvind.ravulavaru@gmail.com https://thejackalofjavascript.com

License

Contributing

Contributions are highly welcome!

install

npm i color2code

Downloadsweekly downloads

2

version

0.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability