Sprite renderer colors + Instigate

There are two things i would like to know in order to be able to continue with my (fairly bad) project.

  1. What is the line / method to set a function to run when an object is created through instigation / when it appears in general? (I am probably going to use this to make projectiles for my game.)

  2. How do you use SpriteRenderer.color ? It does not come with any information on the unity website. My goal is to make the projectile change to a random color from a list of a few arrays. I wrote the array in hex, dont know if there is a way to use a hex array. If not, i can always convert it.

My goal is to let the player shoot towards the mouse pointer, from their location.
When the ‘shot’ projectile appears, it should select a random color, rotate towards the pointer and just fly in a straight line until it goes off-screen or something, and then is destroyed.

Thanks in advance.

Resources-----------------

        string[] colorrandoms = { "FF0000FF", "FF8E00FF", "FFED00FF", "9CFF00FF", "08FF00FF", "00FFB5FF", "00AAFFFF", "1300FFFF", "9C00FFFF", "FF00EDFF" };

 if (Input.GetKeyDown("Fire1"))
            SpriteRenderer renderer = GetComponent<SpriteRenderer>();
            SpriteRenderer.color = colorrandoms[Random.Range(0, colorrandoms.Length)];

… anyone ;p