Babies can tell the difference between light and dark while they are still in the womb.
https://www.nvisioncenters.com/childrens-eye-health/babies-see-color/
When they are first born, babies are extremely sensitive to light. Newborns can see contrast between black and white shapes. The first primary color they are able to distinguish is red. This happens in the first few weeks of life.
Babies can start to notice differences in shades of colors, particularly between red and green, between 3 and 4 months old. Actual color vision and the ability to see color develop when a baby is around 5 months old. Babies do not have as clear or sensitive color vision as adults at this age, but they should be able to notice the differences and see colors.