How to assign a color to a game object & destroy it when it collides with another game object of same Color

So i have a gameobject of blue color, now how do i assign that color to a game object is through code or do we have a tool in Unity and after this is done. i want the game object to destroy upon colliding with another gameobject of same color is there any method that i can use or a function that i can call. 98488-blu-obj.png

im no pro at unity but you could do something like this you could set a variable and go like this.spriterenderer.color and set the same for the other object, then oncollision do an if statement to compare the two variables, im no pro but i think you could do it this way.

Are we talking about a 3D object’s material or a sprite?