If this is done with a Curve Guide force field to guide the particles along the path, there is as far as I know no way to get a particle's position on the curve directly.
However, the way this can be achieved is by using the fact that the Lifetime of a particle determines its speed to move along the curve. This way the age of a particle is telling you how far it has already come - and I guess this is how it's done in the reference video.
In the Shader Editor you can use a Particle Info node which provides the Age and Lifetime of a particle. If you take a Math node and divide Age by Lifetime you get the percentage of the distance it traveled along the curve.
You can then plug the result into a Color Ramp to color the particles according to their age and by this also the traveled distance. It doesn't matter if you have a fixed Lifetime for all particles or set a Random value to vary the lifetime (and speed thereby).
Notice that this Particle Info node only works in Cycles, not in Eevee. The material has to be put on the object which you instance for rendering, in my example it's an icosphere:
Quick sidenote: this is a solution for particles. If you are doing this with Geometry Nodes and instance objects along a curve by Spline Parameter > Factor node, you get the position in percentage of travel distance directly. If you take this as an attribute to reference in a material shader, this will work in Eevee, too. I made the particle version because you asked for particles, but I guess someone can provide a good answer using Geometry Nodes as well.