Show HN: A color name API that maps hex to the closest human-readable name

meodai.github.io

26 points by meodai 2 days ago

I built this API to return the closest named color for any hex value—using curated lists like my own [1], XKCD [2], and others.

I made it from scratch without Express or any frameworks because:

- I’m a frontend/interaction dev and wanted to learn how to build an API from the ground up. - Existing APIs didn’t guarantee unique names per color—mine does. - It also supports WebSocket updates, gzip responses, and multiple name sets.

I’ve been collecting color names for over 10 years [1]. With ~30,000 entries, bundling them into every color-related project became excessive. This API keeps things lightweight—for me and hopefully for others too.

GitHub: https://github.com/meodai/color-name-api

Would love feedback on naming logic, accuracy, performance, or backend best practices I might’ve missed.

[1] Large Color Name List: https://github.com/meodai/color-names [2] XKCD color survey results: https://xkcd.com/color/rgb/

magic_hamster 22 minutes ago

This is nicely done, but can you please explain why you need this? What is the use of the color names when you already know the actual color value and can use it?

  • auscompgeek 12 minutes ago

    This can be useful for accessibility. For example you might have a colour palette that users can add to, but the colours are only stored as hex codes. Giving a screen reader user just RGB values isn't as helpful as providing a name alongside it.

Gys an hour ago

Beautifully made! But I struggle a little for thinking of use cases? Maybe add some to the readme.

Also, I think adding a kind of ‘main color’ would be useful. For example ‘shore’ being in the category ‘blue’ or maybe even ‘light blue’. Because for ‘shore’ itself I personally would associate with sand and maybe yellow.

rossant 2 hours ago

What distance metrics do you use?