How to change color property of the Sprite Renderer in C#

I am looking to make an effect where when the enemy in my game will darken out when they are out of the player’s torch light. I have written the code to determine how much the enemy should fade (based on distance), but I need to apply the value I get. So I need to change the RGB color values in the sprite renderer color property using C#. Thanks for any help I get

GetComponent().color = your color, should work.