colorally
v2.0.8
Published
Name colors by well-known definitions
Downloads
40
Readme
🎨 colorally - Name colors by well-known definitions.
Provide a color and colorally will measure the color difference against a set of well-known definitions and return the name of the closest match. Available as a command-line application, CommonJS and ES module.
Why
- Consistent color names between projects.
- End the use of non descriptive color names, ie.
color-faded-gray
. - Measures difference by delta-e (difference perceived by the human eye).
- Over 950 different color definitions.
- Allows input and output in multiple formats.
Install
Using npm:
# Install locally.
$ npm install colorally
# Install globally.
$ npm install --global colorally
Using yarn:
# Install locally.
$ yarn add colorally
# Install globally.
$ yarn global add colorally
Build from source:
$ git clone [email protected]:sQVe/colorally.git
$ cd colorally/
$ npm install && npm run build
Command-line application
You can either install the application, see above, or run it temporarily with npx colorally
.
colorally - Name colors by well-known definitions
USAGE
colorally [option...] [hex]
colorally [option...] [red] [green] [blue]
The hex argument can contain either 3 or 6 digits with an optional leading
0x or #.
The red, green and blue arguments may only contain digits.
OPTIONS
-V, --version output version number
-c, --copy copy definition to clipboard
-f, --format case output definition in specified format
-h, --help output usage information
-v, --verbose provide a more talkative result
The case argument can be either camel fooBar, constant FOO_BAR, dot foo.bar,
kebab foo-bar, lower foo bar, pascal FooBar, snake foo_bar title Foo Bar or
upper FOO BAR. By default, colorally sets case as title.
API
colorally is available as a CommonJS and ES module.
import colorally from 'colorally'
// Onyx.
colorally(0x111111)
colorally(119227)
// Light Gray.
colorally('ccc')
colorally('0xccc')
colorally('#cccc')
colorally('cccccc')
colorally('0xcccccc')
colorally('#ccccccc')
// Fuzzy Wuzzy.
colorally([200, 100, 100])
colorally(value)
Parameters
value
(number
,string
or[number, number, number]
) - A color value
Returns
The closest matching definition object together with its measured distance:
{
distance: number,
name: string,
rgb: [number, number, number]
}
Contributing
Bug reports & feature requests
Please use the issue tracker to report bugs or make feature requests.
Developing
Pull requests are more than welcome. The following will get you started:
- Fork this repository to your own GitHub account and then clone it to your local device.
- Run
npm install
in the created directory to install all necessary dependencies.
Style guide & conventions
Follow functional programming best practices - use pure functions and composition when possible. Write commit messages with Angular Commit Message Conventions. This enables semantic-release
to do all kinds of automatic goodies (release, changelong and more). Linting and formatting is heavily enforced on both pre-commit
and on push to Travis.
Shout-out
Color definition sources:
License
MIT License