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.
- 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.
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
import { getColorName } from 'hexcolor-namer'
const colorCode = '#FF5733'
const { name: colorName, nearestMatching, exactMatch } = getColorName(colorCode)
console.log(`Color ${colorCode} is named "${colorName}"`)
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.
This project is licensed under the GNU v3 License - see the LICENSE file for details.