Wow I was struggling with this exact problem earlier today. I scraped a list of all css color names into a union so I could get them in my autocomplete, but also wanted to allow any valid css color without having to make template literals for every possible valid color string.
Stealing this!! Thanks for sharing!