I want to be able to change the disabled colour of my button programmatically in c#. Can anyone please help, as all the answers I’ve seen online do not work for me. Could someone help incorporate it into my code? Thanks, in advance!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class o2aPress : MonoBehaviour {

public Button yourButton;
public GameObject button;

void Start () 
{
	Button btn = yourButton.GetComponent<Button>();
	btn.onClick.AddListener(TaskOnClick);
}
void TaskOnClick()
{
	PlayerPrefs.SetInt ("Option2aDone", 1);

}
void Update()
{
	if (PlayerPrefs.GetInt ("Option2aDone") == 1) {
		//would like to change the disabled colour here!
		yourButton.interactable = false;
		PlayerPrefs.SetInt ("o2b", 1);
	}
	if (PlayerPrefs.GetInt ("o2a") == 1) {
		yourButton.interactable = false;

	}
	}
}

Assign a new ColorBlock to yourButton.colors:

var newColorBlock = yourButton.colors;
newColorBlock.disabledColor = /*your color here*/;
yourButton.colors = newColorBlock;