Skip to content
forked from shariati/cherangi

A small javascript library that finds an exact or similar color name.

License

Notifications You must be signed in to change notification settings

meodai/cherangi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cherangi

npm version Known Vulnerabilities

A small javascript library that helps you find the name of a color (Over 14K 🎨 color names).

Meaning

Cherangi (Che Rangi?) is a Farsi (Persian) sentence which means "What color?"

Install

$ npm install --save cherangi

Usage

const cherangi = require('cherangi');

cherangi('#cfcfcf');

About Returned Object

The returned value holds the color information and if consists of a status , name, hex, delta and a message

Status

Holds the status information of the results which could be one of the following

Status Code Status Description
0 Exact Match
2 Not perceptible by human eyes.
4 Perceptible through close observation.
8 Perceptible at a glance.
-1 No Color match found

Name

A <string> that represents the color name of the input value if no exact match has been found then the most similar color will be returned.

Hex

A <string> that returns the matched color / similar color code in hex

Delta (E 76)

Delta E is a metric for understanding how the human eye perceives color difference. The term delta comes from mathematics, meaning change in a variable or function. The suffix E references the German word Empfindung, which broadly means sensation.

Message

A <string> to show the description of the current result.

Returned Object (Sample)

  • Valid
{
	status: 8,
	name: 'Neon Green',
	hex: '#39ff14',
	delta: 2.8270216256677023,
	message: 'Perceptible at a glance'
}
  • Invalid Input For now all invalid inputs are handled as black color. This will be changed with a proper staus code in near future
{
	status: 1,
	name: 'Black',
	hex: '#000000',
	delta: 0,
	message: 'Exact Match'
}

CLI

$ npm install --global cherangi
$ cherangi --help

  Usage
    cherangi 'hexcode'
    cherangi '#hexcode'

  Example
    cherangi 'fff'
    cherangi '#fcfcfc'

Thanks to

Disclaimer

Please note cherangi uses color-names for the list of colors and in the process of creating this list the author tries to remove all names that are offensive or racist, as well as protect brandnames. As some of the color names come from other lists, it might happen that some bad ones slip in. Please report them, they will be removed as quickly as possible.

About

A small javascript library that finds an exact or similar color name.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%