Change Sprite in script (C#)

Hi everyone, I’m trying to change the sprite from a script, I saw other similar answers but the solution doesn’t work for me, here’s the code, thanks for your help.

I’m not sure about the Getcomponent thing in the start method, If my Gameobject already have a spriterenderer do I have to do this?

using UnityEngine;
using System.Collections;

public class BluetoGreen : MonoBehaviour 
{
	public Sprite red;

	void Start ()
	{
		SpriteRenderer = GetComponent<SpriteRenderer>();
	}
	
	void OnMouseDown() 
	{
			ColorChangered();
	}
	void ColorChangered() 
	{
		SpriteRenderer.sprite = red;
	}
}

thanks to Mayank and jokim.

Here’s the answer for future references (thanks to Mayank and jokim for the answer)

make sure you have given Red sprite in gameobject where you used this script and use a reference like that

SpriteRenderer sr;
void Start()
{
     sr = GetComponent<SpriteRenderer>();
}

When you want to change it :

 sr.sprite = red;