Change colour of particle system upon collision

I want the colour of my particle system to change when it collides with another object. How can I do this based in the 2020.3 Unity version? I’ve already set the start colour. I’ve tried using

ps = GetComponent();

Color color = new Color32(141, 224, 179, 125);

main.startColor = color;

and

ps.getComponent();

colorModule = ps.colorOverLifetime;

colorModule.color = ParticleSystem.MinMaxGradient(Color.green);

you can use OnParticleCollision() and change the color from there. It’s a bit similar with OnCollisionEnter() and available in MonoBehaviour.