Give me a color and I'll name it.

npm install color-namer
3 downloads in the last week
14 downloads in the last month

Color Namer

Give me a color and I'll name it.

Color Namer is a node module that calculates color distance using the Delta-E color difference technique. Given a color in some format like RGB, HSL, or HSV, it uses the awesome chroma-js node module to convert the color to the Lab* color space, then calculates the color's Euclidean distance from a set of colors with known names.


npm install color-namer --save


Easy peasy:

var namer = require('color-namer');
var names = namer("#FF0000");

The function returns an array of colors, sorted by proximity:

  { name: 'red',
    hex: '#FF0000',
    distance: 0 },
  { name: 'orangered',
    hex: '#FF4500',
    distance: 13.170205025755513 },
  { name: 'tomato',
    hex: '#FF6347',
    distance: 31.733444038510665 },
  { name: 'crimson',
    hex: '#DC143C',
    distance: 35.38084849496472 },
  { name: 'firebrick',
    hex: '#B22222',
    distance: 40.71076805218006 },
  { name: 'coral',
    hex: '#FF7F50',
    distance: 42.340752375722616 },
  { name: 'chocolate',
    hex: '#D2691E',
    distance: 44.378454180212145 },
  { name: 'darkred',
    hex: '#8B0000',
    distance: 46.37258642138143 },
  { name: 'darkorange',
    hex: '#FF8C00',
    distance: 46.9522874117045 },
  { name: 'brown',
    hex: '#A52A2A',
    distance: 50.15162168414592 },
  { name: 'maroon',
    hex: '#800000',
    distance: 51.42076545740547 },
  { name: 'salmon',
    hex: '#FA8072',
    distance: 53.52177627659905 },
  "... et cetera"


npm test

✓ is a function
✓ returns an array of candidates with distance values
✓ defaults to HTML color candidates
✓ accepts custom color candidates
✓ validates format of custom candidates
✓ matches inexact colors
✓ matches exact colors
✓ accepts hex strings that include a hash symbol
✓ accepts non-hex input formats



npm loves you