RGB values of object color is not working properly

Hi! I want to be able to compare the color of an object with another color stored on the script of the object.
The problem is that when i try to compare them, no matter what color the object has in the beginning, when i debug the RGB, values are shown as 1. So even if the start color of the object is red, it will always show in my script as white.

**
public class CheckColor : MonoBehaviour
{

[SerializeField] Color otherColor;

private void Start()
{
Color thecolor = GetComponent().material.color;

Debug.Log(thecolor.r);

Debug.Log(thecolor.g);

Debug.Log(thecolor.b);

}

}

Probably because by default float gets rounded when converted to string. Something like (manually specifying string format):

Debug.Log(thecolor.r.ToString("F3"));

Will probably do the job