Material transition from blue color spectrum to red color spectrum

I am working on a material that would smoothly pass through the spectrum of colours from blue to red. So the basic color would be blue and it would be gradually incremented as shown in the picture. I am currently using lerp_3color but it only paints green and then red, there is no smooth transition, for example the yellow color is not displayed


That’s because Vertex Color doesn’t do what you think it does.
You have it properly setup.

Here’s an alpha to actually see what it’s doing.


I have the sine period set to 20 to make it easier to see.

Thanks. Im using this plugin (highly recommended) Runtime Vertex Color Paint & Detection Plugin in Code Plugins - UE Marketplace so vertex color is changing depending on mesh overlap. Proposed solution works but its repetitive cycle, I have not mentioned that but red should be max, no more color increasing and blue should be default, minimum.