color-groups

1.0.2 • Public • Published

color-groups

Build Status npm version codecov Mutation testing badge

Find and display HTML colors by group or find the primary color that any named color belongs to.

Based on W3C named colors.

Install

$ npm install color-groups

Usage

const colorGroups = require('color-groups')

Find all the named colors that belong to one group.

const oranges = colorGroups.get.orange    // [ 'orange', 'darkorange', 'coral', 'tomato', 'orangered' ]

Find the main group that a named color belongs to.

const primary = colorGroups.find('papayawhip')    // 'yellow'

Find the main groups that many named colors belong to.

const myColors = ['palevioletred', 'lemonchiffon', 'cornsilk']
 
const primaries = myColors.map(color => colorGroups.find(color))    // [ 'pink', 'yellow', 'brown' ]

Authors

Tim Dunphy

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Package Sidebar

Install

npm i color-groups

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

6.48 kB

Total Files

4

Last publish

Collaborators

  • meanboycousin