2.3.3 • Published 4 years ago

imagecolor v2.3.3

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

Installation

project installation

npm install --save imagecolor

cmd installation

Inorder to use imagecolor as a command line tool you install it globally by running the following command:

npm install -g imagecolor

Usage

Project usage

const {getColor} = require("imagecolor");

const file = { ( absolute || relative ) path to img};

getColor(file).then( (colors) => console.log(colors) ).catch(err=>console.log(err))
Example
const {getColor} = require("imagecolor");

const file = "C:\Users\Pictures\image.jpg";

getColor(file).then( (colors) => console.log(colors) ).catch(err=>console.log(err))
Output

By default imagecolor extracts the first 10 colors and returns the name,hex,rgb.

[
  { name: 'Bronco', hex: '#a7a195', rgb: 'rgb(167,161,149)' },
  { name: 'Shark', hex: '#232529', rgb: 'rgb(35,37,41)' },
  { name: 'Tasman', hex: '#d8dfd7', rgb: 'rgb(216,223,215)' },
  { name: 'Spicy Mix', hex: '#785140', rgb: 'rgb(120,81,64)' },
  { name: 'Roman Coffee', hex: '#816355', rgb: 'rgb(129,99,85)' },
  { name: 'Fiord', hex: '#3d506c', rgb: 'rgb(61,80,108)' },
  { name: 'Submarine', hex: '#c3cbcc', rgb: 'rgb(195,203,204)' },
  { name: 'Soft Amber', hex: '#d5c5b8', rgb: 'rgb(213,197,184)' },
  { name: 'Fun Blue', hex: '#1f429a', rgb: 'rgb(31,66,154)' }
]

Overiding default color count

To overide default colors of 10 , pass a second argument to the getColor function the numbers of colors you want .

getColor(file,5).then( (colors) => console.log(colors) ).catch(err=>console.log(err))
Output
[
  { name: 'Bronco', hex: '#a7a195', rgb: 'rgb(167,161,149)' },
  { name: 'Shark', hex: '#232529', rgb: 'rgb(35,37,41)' },
  { name: 'Tasman', hex: '#d8dfd7', rgb: 'rgb(216,223,215)' },
  { name: 'Spicy Mix', hex: '#785140', rgb: 'rgb(120,81,64)' },
  { name: 'Roman Coffee', hex: '#816355', rgb: 'rgb(129,99,85)' }
]

Options

NameDescriptionDefault value
filePath to fileREQUIRED
countnumbers of colors to return10

cmd usage

To use imagecolor as a cmd tool,install globally and run the following command:

getImageColor { ( absolute || relative ) path to img}
Example
getImageColor C:\Users\Pictures\image.jpg
Output

image color test

Overiding default color count

To overide default colors of 10 pass the count argument of the number of colors you want

getImageColor C:\Users\Pictures\image.jpg 15
output

image color test 2

2.3.2

4 years ago

2.3.3

4 years ago

2.3.1

4 years ago

2.2.1

4 years ago

2.1.1

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago