Apply rainbow texture per-strand with an Alembic groom?

I was wondering if there is a way to apply a rainbow texture like this:

for each strand of hair, the root being red and the tip being that hot-pink color?

Is there any tutorials or reference I could look at to help come to an answer like this? I’m digging around the hair material (using the hair shader) but haven’t had much luck.