←back to thread

97 points meodai | 2 comments | | HN request time: 0.43s | source

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. 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 #
2. 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…