Trail Colors ??

i want to change the trail colors [0, 1, 2, 3, 4] but i can’t find a way to access them unless i use an editor script:

using UnityEngine;
using System.Collections;
using UnityEditor;

namespace UnityEditor
{
	public class editor_Shop : MonoBehaviour
	{
		public static void GetTrailColors (TrailRenderer t)
		{
			TrailRenderer trail = t;
			SerializedObject Trail = new SerializedObject(trail);
			
			Trail.FindProperty("m_Colors.m_Color[0]").colorValue = Color.green;
			Trail.FindProperty("m_Colors.m_Color[1]").colorValue = Color.black;
			Trail.FindProperty("m_Colors.m_Color[2]").colorValue = Color.gray;
			Trail.FindProperty("m_Colors.m_Color[3]").colorValue = Color.blue;
			Trail.FindProperty("m_Colors.m_Color[4]").colorValue = Color.white;

			Trail.ApplyModifiedProperties();
		}
	}
}

but it wont apply on devices because it’s an editor script ! so what to do ??

It also matters which material you are specifying on trail property. if you have not added first add material to it[either using script or in inspector window].