set unity particle system color main code example
Example 1: particle system start color
Color myColor;
var particlesMain = gameObject.GetComponent<ParticleSystem>().main;
particlesMain.startColor = myColor;
Example 2: unity particle system color
Color myColor;
gameObject.GetComponent<ParticleSystem>().startColor = myColor;