All Projects → glennreyes → name-this-color

glennreyes / name-this-color

Licence: MIT License
Gives your colors a human-friendly name

Programming Languages

javascript
184084 projects - #8 most used programming language

Name this Color

Build Status Coverage Status Dependency Status npm version

Gives your colors a human-friendly name, inspired and powered by Name that Color from Chirag Mehta.

Motivation

Name this Color is incredibly useful when you are structuring your color palettes, no matter if it is for your design tool or CSS. Especially for CSS pre-processors like Sass or Less, this module will help you to get a very well structure on naming your colors.

The biggest pain is when you are trying to get your exact shade for #eecd11 by calling your Sass variable $a-bit-lighter-than-middle-light-orange for instance. This module would provide you a smarter name like ripe-lemon.

Installation

npm install name-this-color --save-dev

Usage

This module supports the one-color API of how you pass the color. The method returns an array of color objects.

var nameThisColor = require('name-this-color');

nameThisColor('#0088aa'); // or '#08a', '0088aa', '0088AA'
// => [{ hex: '#0088aa', title: 'Deep Cerulean', match: false, name: 'deep-cerulean' }]

nameThisColor('rgb(255, 0, 0)'); // or 'red', 'rgb(100%, 0%, 0%, .5)'
// => [{ hex: '#ff0000', title: 'Red', match: true, name: 'red' }]

nameThisColor(['#0088aa', '#8800aa', '#aa8800', '#aa0088']);
/** =>
 [{
   hex: '#0088aa',
   title: 'Deep Cerulean',
   match: false,
   name: 'deep-cerulean'
 }, {
   hex: '#8800aa',
   title: 'Purple',
   match: false,
   name: 'purple'
 }, {
   hex: '#aa8800',
   title: 'Pirate Gold',
   match: false,
   name: 'pirate-gold'
 }, {
   hex: '#aa0088',
   title: 'Flirt',
   match: false,
   name: 'flirt'
 }]
 */

Properties

hex

A transformation from the given color to a HEX.

title

The (approximate) title, referencing Wikipedia's List of colors

match

Boolean of a match in the Wikipedia's List of colors

name

The param-cased title

License

This project is licensed under the MIT license, Copyright (c) 2016 Glenn Reyes. For more information check LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].