Destroy at collision based on color

I’m really new to Unity, I was wondering how I would go about the following collision: Two spheres destroy on collision if they are the same color . Any advice or scripts would be awesome!? Thank you!

The easiest way would be to add this same script to all spheres, no matter which color they are:

function OnCollisionEnter(other: Collision){
    var myColor = renderer.material.color;
    var otherColor = other.transform.renderer.material.color;
    if (myColor == otherColor){ // if colors are the same...
        Destroy(gameObject);    // suicide

Thank you!!

I can’t understand please make video on YouTube