Most active commenters
  • meodai(17)
  • kiru_io(3)

97 points meodai | 53 comments | | HN request time: 1.546s | source | bottom

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/

1. rossant ◴[] No.44335542[source]
What distance metrics do you use?
replies(1): >>44336006 #
2. Gys ◴[] No.44335587[source]
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.

replies(1): >>44336018 #
3. kiru_io ◴[] No.44335842[source]
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

replies(2): >>44336041 #>>44339831 #
4. magic_hamster ◴[] No.44335894[source]
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?
replies(3): >>44335939 #>>44336037 #>>44336101 #
5. auscompgeek ◴[] No.44335939[source]
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.
6. meodai ◴[] No.44336006[source]
CIEDE2000 ΔE: https://github.com/meodai/color-name-api/blob/main/src/close...
replies(1): >>44336113 #
7. meodai ◴[] No.44336018[source]
Oh I mostly use it for my own apps – it just feels more human-readable than hex codes. But yeah, you're right, I should add some example use cases to the readme!

Like here:

https://farbvelo.elastiq.ch/ or https://meodai.github.io/poline/

Thanks a lot for the feedback, I really appreciate it!

8. meodai ◴[] No.44336037[source]
Thanks! Good question – it's mostly about readability and communication. Hex codes are precise but not intuitive. Names give context, like saying “salmon” instead of #fa8072. That’s helpful in design tools, UI previews, generative art, or even debugging.

Also, the API works the other way around too – you can search by name to get the matching color: https://api.color.pizza/v1/docs/#api-Default-getColorNames. I did not add it to the website yet, because I don't have good UI ideas for it yet.

9. meodai ◴[] No.44336041[source]
nice its very addicting :D
replies(1): >>44337229 #
10. chownie ◴[] No.44336101[source]
N=1 but I'm colourblind and frequently I need to talk to someone about a UI colour while not having any idea what the colour is called, this kind of thing is useful for me.
replies(5): >>44336124 #>>44336292 #>>44336317 #>>44336852 #>>44349716 #
11. kotaKat ◴[] No.44336110[source]
Curious if you could run it against the big old list of HN topcolors...

https://news.ycombinator.com/topcolors

replies(2): >>44336243 #>>44338253 #
12. meodai ◴[] No.44336113{3}[source]
PS: I've added a section to the Readme: https://github.com/meodai/color-name-api?tab=readme-ov-file#...
13. meodai ◴[] No.44336124{3}[source]
That's great to hear! I've gotten some very positive feedback from sight-impaired users for this little tool that uses the API: https://words.github.io/color-description/ — it turns colors into descriptive text (no AI involved)
14. meodai ◴[] No.44336243[source]
I just did, using `npx palette-aldente hn-colors.yml --formats name --namelist bestOf`: https://codepen.io/meodai/pen/ByNqbKE
replies(1): >>44336483 #
15. polonbike ◴[] No.44336292{3}[source]
N>1, proportion of colourblind people depends on the origin, but there are many of us. In Europe, nearly 10% of males are impacted by one of the colourblind variant, aka millions of people. Some of those people are dev, designers, or working alongside some sort color requirements, but none of them are graphists and can choose colors. Having a tool to provide a name instead of an hex code is useful to discuss colors with other stakeholders (customers, colleagues, etc...)
replies(1): >>44336980 #
16. unconed ◴[] No.44336317{3}[source]
I made a similar tool that can work on images and the camera. In addition to color picking, it adds moving stripes so you can visually tell the difference between colors you might otherwise not tell apart.

https://unblind.tech

17. nkrisc ◴[] No.44336385[source]
You have to scroll all the way to the top to turn off the distracting shapes falling, at least on mobile.
replies(1): >>44336454 #
18. meodai ◴[] No.44336454[source]
yes! but I could add a second button at the footer. (it also respects the reduced motion flag, if you set it in your OS)
19. bargainbin ◴[] No.44336483{3}[source]
"Safety Orange" is quite apt!
replies(1): >>44337570 #
20. pimlottc ◴[] No.44336852{3}[source]
I would also find such a tool useful, but names like “Watermelon Sugar”, “Tidal”, or “Singapore Orchid” don’t really help me at all. Just tell me something like “dark brown”, “pale green”, “hot pink”, “tan”, etc.
replies(2): >>44337898 #>>44338099 #
21. Theodores ◴[] No.44336890[source]
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?

replies(1): >>44338385 #
22. rustc ◴[] No.44336980{4}[source]
> Having a tool to provide a name instead of an hex code is useful to discuss colors with other stakeholders (customers, colleagues, etc...)

But how useful are names that this website shows, e.g. the first few random names I got were "Singapore Orchid", "Scented Spring", "Lamiaceae", and "Lunatic Sky Dancer"?

replies(1): >>44338090 #
23. esperent ◴[] No.44337110[source]
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.

24. johnisgood ◴[] No.44337229{3}[source]
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.

replies(1): >>44338741 #
25. airstrike ◴[] No.44337244[source]
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?

replies(2): >>44337453 #>>44337747 #
26. Sharlin ◴[] No.44337453[source]
Everything is a microservice now!
27. jen729w ◴[] No.44337570{4}[source]
I've based my entire colour palette on a tweak of international orange. A delightful colour. (I went with #f04c00.)

https://en.wikipedia.org/wiki/International_orange

28. tillcarlos ◴[] No.44337722[source]
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.

replies(1): >>44338149 #
29. ZoomZoomZoom ◴[] No.44337741[source]
There's also https://colornames.org/ - crowdsourced attempt at naming all the colours. Currently at 25% (4215221).
replies(1): >>44338065 #
30. meodai ◴[] No.44337747[source]
Because a) I keep adding names and b) the list weights over 1mb https://github.com/meodai/color-names
replies(1): >>44341722 #
31. IshKebab ◴[] No.44337898{4}[source]
Yeah I agree. Maybe useful if it wasn't nonsense paint colour names.
replies(1): >>44338193 #
32. meodai ◴[] No.44338065[source]
Unfortunately most of the names are pretty bad.
33. meodai ◴[] No.44338090{5}[source]
I provide all kind of name lists. Depends a lot on what you are trying to accomplish. But there are plenty of lists providing more recognizable ones.
34. meodai ◴[] No.44338099{4}[source]
If you scroll down a bit, you will see that the api provides all kind of lists, there are plenty that are more descriptive or simpler depending on what you are going for.
35. meodai ◴[] No.44338149[source]
nước đái I use it for all kinds of color generators.
36. meodai ◴[] No.44338193{5}[source]
The API provides plenty of lists that should fit your less ‘nonsensical’ needs.
37. h1fra ◴[] No.44338253[source]
what's the story behind this page?
replies(1): >>44340164 #
38. meodai ◴[] No.44338385[source]
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…
39. JdeBP ◴[] No.44338721[source]
I noticed the other day that the colour picker in Microsoft Termimal now gives the Web Colour names as one moves the mouse pointer around. I don't know how long it has been doing that without my noticing. I don't change colours all of that often. (-:
40. brulard ◴[] No.44338741{4}[source]
And the scoring is quite generous. For the coupe color I picked vibrant red, correct was some steel gray and I got 60/100 points
replies(2): >>44339033 #>>44346635 #
41. kuehle ◴[] No.44338781[source]
Makes me wonder which area of the Color space has the lowest resolution. As in “this name covers the most hex codes”.
replies(1): >>44338872 #
42. meodai ◴[] No.44338872[source]
Wonder no longer: https://codepen.io/meodai/full/zdgXJj/ Color distribution of Color-Names in various color models
43. johnisgood ◴[] No.44339033{5}[source]
I agree.

I remember there were a couple of websites like this, however, with random colors, better scoring, etc.

For example I found these:

https://color.method.ac

https://hexcodle.com (this one has a 10 hour limit per game, ugh)

But there were many others. Ideas? I am looking for something like colorguesser.com.

44. remram ◴[] No.44339831[source]
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?

replies(1): >>44346621 #
45. kotaKat ◴[] No.44340164{3}[source]
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. :)
replies(1): >>44341638 #
46. efilife ◴[] No.44341638{4}[source]
weren't these just latest colors set by users?
47. airstrike ◴[] No.44341722{3}[source]
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.
48. aaviator42 ◴[] No.44343268[source]
Those who find this interesting may find my tool helpful, a color picker that only has named HTML colors: https://aavi.xyz/proj/colors
49. kiru_io ◴[] No.44346621{3}[source]
> 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.

50. kiru_io ◴[] No.44346635{5}[source]
Actually I experienced with different distance metrics and settled for one.
51. andoando ◴[] No.44349716{3}[source]
Wouldnt it be 10x better to just show them the color?
replies(1): >>44375246 #
52. chownie ◴[] No.44375246{4}[source]
Unfortunately I'm not a chameleon, so I can't magic it up on my skin mid-conversation. We communicate verbally, I need a name or I can't talk about it.