The cows are very crowded and there are too many to survive on the land
Survival of the Fittest
There was a mutation in a gene protein that caused some of the offspring to be pink and white with shorter legs instead of black and white with long legs.
The cows natural predator is the elephant. They have to run away from them and their main means of survival is finding caves that they can hide in that are too big for the elephants.
Changes in Gene Pool
The pink cows have shorter legs, making them more likely to find caves they can survive in. The black and white cows have less options, leaving them outside to the mercy of the elephants. This leaves the pink cows with a higher survival rate.
The population of pink cows has gone from 2 to 5, and black and white cows has gone from 7 to 4. Natural selection is selecting for pink cows and against black and white cows. This leaves more pink cows alive to have pink offspring, giving the pink cows higher fitness.
Over time, cows with the most suitable version of a trait for the environment (pink with short legs) will gain a great amount of fitness compared to the other version. This causes the gene pool to be primarily dominated by the pink short legged gene, over time increasing the percentage of the population with short legs and a pink color.