Is there a way to easily assign a given hex color code to a more general category (red, gren, blue, yellow, orange, pink, black, white, grey, ...)?

Like `#ffcc55` -> orange, `#f0f0f0` -> white, ...

EDIT: or even just similar to adobe photoshop finding the nearest web safe color, so it would reduce the number of colors to 256, would be already a great solution!