Detecting the Green in a Material's Color on Collision

I am trying to determine if the green in a material’s color is greater than 0.99f on a collision in C#?

    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.GetComponent<Material>().color.g > 0.99)
        {
            print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
        }
    }

‘Material’ isn’t a component that can be added to an object. Instead, you’ll need to get it from the renderer;

if (collision.gameObject.GetComponent<Renderer>().material.color.g > 0.99f)
{
    print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}