Sheep aren’t painted for identification.
Rams carry marking devices in rutting season. The coloured sheep are the ewes that have been serviced by the ram. If you have more than one ram running with the flock, you might give each ram a different colour, to help distinguish which ewes are in lamb to each ram.
It’s a ram-diddling-ewe-dye-ID-little-lamb-doodah.
Quora linky.