Might be better to vectorize early on (see [matplotlib's implementation here](https://github.com/matplotlib/matplotlib/blob/a3abbb458e7142f76c8d465bba7e85c0bcb4de15/lib/matplotlib/colors.py#L1298)).