Readit News logoReadit News
Posted by u/meodai 2 months ago
Show HN: A color name API that maps hex to the closest human-readable namemeodai.github.io/color-na...
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/

airstrike · 2 months ago
Really nice idea. I've thought about building something similar but it's not a core feature of my product so I keep postponing it.

I do have to ask, though. Why would I ever want to resolve a color name as a network request instead of calling a function?

meodai · 2 months ago
Because a) I keep adding names and b) the list weights over 1mb https://github.com/meodai/color-names
airstrike · 2 months ago
I'd definitely prefer to add 1MB to my binary than to make a remote API call, and I can always bump the version if I want the latest and greatest names.
Sharlin · 2 months ago
Everything is a microservice now!
kiru_io · 2 months ago
Wow, pretty cool to see the color-names project here. I made a simple color guessing website a few years ago [0] using your library. I almost forgot it till someone reminds how they enjoyed it ([1]).

[0] https://colorguesser.com/ [1] https://x.com/wifeofnoob/status/1935788167086436375

remram · 2 months ago
Fun! If I may make one suggestion, could you please show the color I picked next to the real one once it is revealed?

edit: I get the same 5 colors every time?

kiru_io · 2 months ago
> I get the same 5 colors every time? That's probably a bug.

> Fun! If I may make one suggestion, could you please show the color I picked next to the real one once it is revealed? The color of the color-name changes to what you picked.

meodai · 2 months ago
nice its very addicting :D
johnisgood · 2 months ago
Guess the Color

Lilac Rose

Your score

81/100

First try!

My final score was 286/500 :(

At any rate, it keeps using the same colors, so this needs to be improved.

aaviator42 · 2 months ago
Those who find this interesting may find my tool helpful, a color picker that only has named HTML colors: https://aavi.xyz/proj/colors
Theodores · 2 months ago
I fully approve of this app. My use case is CSS, more specifically SVG. I put SVG in custom properties for things like icons, then use them as pseudo elements, thereby keeping decoration out of the HTML and avoiding downloads for SVG specified in CSS. My SVG is always human readable and simple.

The slight problem with this is that I don't like having to escape the '#' character for colours. I prefer the nearest name, e.g. 'Chocolate' (which is orange).

Hence I have bookmarked this page.

One observation, I have now moved to oklch for everything else. I only do named colours and oklch, hex codes have gone the way of CMYK for me.

Are there any plans to make this tool oklch-friendly?

meodai · 2 months ago
Thanks for the feedback. For now you would have to do the conversion yourself, but I plan to store the names in a more absolute format like xyz…
ZoomZoomZoom · 2 months ago
There's also https://colornames.org/ - crowdsourced attempt at naming all the colours. Currently at 25% (4215221).
meodai · 2 months ago
Unfortunately most of the names are pretty bad.
kotaKat · 2 months ago
Curious if you could run it against the big old list of HN topcolors...

https://news.ycombinator.com/topcolors

meodai · 2 months ago
I just did, using `npx palette-aldente hn-colors.yml --formats name --namelist bestOf`: https://codepen.io/meodai/pen/ByNqbKE
bargainbin · 2 months ago
"Safety Orange" is quite apt!
h1fra · 2 months ago
what's the story behind this page?
kotaKat · 2 months ago
once you receive 250+ karma, the topcolor setting enables in your profile, allowing you to specify a custom color code for the top bar of HN. this is a ranking of every custom topcolor set by users. :)
tillcarlos · 2 months ago
Is your name Mèo Dài - Longcat in Vietnamese? :)

Cool project! I wonder what commercial use cases come from it. On the My First Million podcast they talked a about a company selling color predictions to brands for multiple six figures. Maybe you can find correlations and predictions in the data one day.

meodai · 2 months ago
nước đái I use it for all kinds of color generators.
esperent · 2 months ago
I like the falling bricks effect although it's quite janky on Brave on Android.

I think it would be effective on the landing page to have a form where I can enter a hex code and get the color name. I've recently tried a couple of web apps like this to get makes for my brand colors.