closest-css-color
Find the closest CSS color keyword for a given hex color value.
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.