←back to thread

97 points meodai | 1 comments | | HN request time: 0.211s | 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/

Show context
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 #
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 #
1. airstrike ◴[] No.44341722[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.