Change terrain texture colour

I have two textures for my terrain. As a default I use the green texture. However I want my user to be able to change the settings of the game to make the texture red. I have buttons in place that change a string to either say “Green” or “Red”. At the start of my game, the below script is run.

using UnityEngine;
using System.Collections;

public class TerrainTexture : MonoBehaviour {

	public Texture green;
    public Texture red;

	public GameObject mapcheck;

	public Terrain terrain;

      void Update ()
      {
           if (mapcheck.GetComponent<Script>().map == "Green")
           {
            // Switch to Green
           }
           else if (mapcheck.GetComponent<Script>().map == "Red")
           {
            // Switch to Red
           }
       }
}

I have done a lot of research but I had various errors when I tried to put anything at my comments. What can I put in place to change the colour of the terrain? (Essentially switching the first texture to the second or vice versa).

My answer here might help: https://answers.unity.com/questions/1788470/changing-terrain-tint-color-via-script.html?childToView=1814992#answer-1814992

In your case you should try to modify the terrain instead of the map, your texture on the TerrainLayer should be black and white and you should assign a Color and not a texture.