How to blend between 3 colors with if nodes

For a scalable and controllable solution you can create a Curve Atlas asset and sample curves from it in the material.