closest-css-color

1.0.0 • Public • Published

closest-css-color

Find the closest CSS color keyword for a given hex color value.

npm version Build status License Contact me

Installation

npm install --save closest-css-color

closestColor(hex, { detailed = false }})

const closestColor = require('closest-css-color')

// normal usage
const color = closestColor('#a00a0a')
console.log(simpleColor)
// -> 'darkred'

// with the `detailed` option
const colorWithAdditionalInformation = closestColor('#1019a6', { detailed: true })
console.log(detailedColor)
// -> {
//     name: 'darkblue',
//     hex: '#00008b',
//     rgb: {red: 0, green: 0, blue: 139}
// }

Contributing

If you found a bug or want to propose a feature, feel free to visit the issues page.

Package Sidebar

Install

npm i closest-css-color

Weekly Downloads

5

Version

1.0.0

License

ISC

Unpacked Size

4.01 kB

Total Files

5

Last publish

Collaborators

  • juliuste