Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

colorally

sQVe21MIT2.0.8

Name colors by well-known definitions

cli, color, delta-e, name

readme

splash

🎨 colorally - Name colors by well-known definitions.

NPM build codecov dependabot semantic-release license

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 git@github.com: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:

  1. Fork this repository to your own GitHub account and then clone it to your local device.
  2. 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

changelog

2.0.8 (2021-11-21)

Bug Fixes

  • definitions: update definitions (run: 37) (8cf087e)

2.0.7 (2021-11-07)

Bug Fixes

  • definitions: update definitions (run: 35) (92d23d4)

2.0.6 (2021-10-17)

Bug Fixes

  • definitions: update definitions (run: 32) (b44b833)

2.0.5 (2021-07-04)

Bug Fixes

  • submodules: update snippets (run: 17) (cec9916)

2.0.4 (2021-06-27)

Bug Fixes

  • submodules: update snippets (run: 16) (6821c76)

2.0.3 (2021-03-09)

Bug Fixes

2.0.2 (2020-10-20)

Bug Fixes

  • build: minimize bundle size (5f686d8)

2.0.1 (2020-09-23)

Bug Fixes

  • definitions: update definitions (cron build: 2652) (c36cb45)

2.0.0 (2020-09-08)

Bug Fixes

  • ci: run travis on node 12 (e877350)
  • definitions: update definitions (34fb2da)

BREAKING CHANGES

  • ci: No longer support Node version lower than 10.

1.0.9 (2020-08-19)

Bug Fixes

  • definitions: update definitions (cron build: 2487) (52349f2)

1.0.8 (2020-07-22)

Bug Fixes

  • definitions: update definitions (cron build: 2444) (9e04090)

1.0.7 (2020-04-29)

Bug Fixes

  • definitions: update definitions (cron build: 2219) (b42e064)

1.0.6 (2020-04-22)

Bug Fixes

  • definitions: update definitions (cron build: 2169) (20ed5fa)

1.0.5 (2020-04-15)

Bug Fixes

  • definitions: update definitions (cron build: 2152) (4835dda)

1.0.4 (2020-01-22)

Bug Fixes

  • definitions: update definitions (cron build: 1680) (15d828b)

1.0.3 (2019-07-18)

Bug Fixes

1.0.2 (2019-06-26)

Bug Fixes

  • definitions: update definitions (cron build: 95) (d01cc0e)

1.0.1 (2019-06-19)

Bug Fixes

  • cli: properly add shebang (1f768ae)

1.0.0 (2019-06-19)

Bug Fixes

  • cli: change hex argument description (0949e1a)
  • definitions: change json formatting (68f8e40)
  • scripts: use auto scrape (0765ef6)
  • test: properly test all hex-string variants (0a60a23)
  • npm version allow same version (70d599f)
  • tweak build and project settings (d576c33)
  • update dependencies and tweak project settings (ceaefe9)

Features

  • add project setup (bab05f1)
  • ci: add ci and release settings (a3b1934)
  • cli: add cli module (a5d6056)
  • colorally: add entry point function (3f6ceea)
  • converters: add converters module (4766551)
  • definitions: add initial color definitions (4392393)
  • ruler: add ruler module (65b96e7)
  • scraper: add scaper for color definitions (32f0dd1)