Check out example codes for "change trail color in script". It will help you in understanding the concepts better.
Code Example 1
TrailRenderer myTrailRenderer = GetComponent<TrailRenderer>();
myTrailRenderer.material.color = myColor;
myTailRenderer.startColor = Color.white;
myTailRenderer.endColor = new Color (0.35f, 1f, 0.75f);
Learn ReactJs, React Native from akashmittal.com