hexcolor-namer
v0.1.3
Published
Get the human name of hexadecimal colors
Downloads
12
Maintainers
Readme
HexColorNamer
HexColorNamer is an npm library that provides human-readable names for hexadecimal colors. It's inspired by Chirag Mehta's Name that Color project and extends its functionality to publish it as an npm library, and support additional languages, including French.
Features
- Convert hexadecimal color codes (e.g., "#FF5733") to descriptive color names (e.g., "Cinnabar"), or the nearest known color.
- Supports multiple languages, including English and will support French in the future.
- Lightweight and easy to use.
Installation
Install HexColorNamer using npm, pnpm, bun, etc:
npm install hexcolor-namer
I am using Bun to develop this library, but of course you can use any package manager you like.
bun add hexcolor-namer
Usage
import { getColorName } from 'hexcolor-namer'
const colorCode = '#FF5733'
const { name: colorName, nearestMatching, exactMatch } = getColorName(colorCode)
console.log(`Color ${colorCode} is named "${colorName}"`)
Credits
HexColorNamer is inspired by Chirag Mehta's Name that Color project. Special thanks to Chirag for his work and permission to create this TypeScript version.
License
This project is licensed under the GNU v3 License - see the LICENSE file for details.