Dear student,
Different elements have different physical properties such as colour, odour, state, etc. I is the property of the iodine that it is violet in colour and chlorine is yellow in colour.
There cannot be any reason for the different colours of the elements.
Regards