If you are invited for a function and there is an instruction for dress code; please dress as instructed. People who have a set of instruction as dress codes are normally meticulous persons and great organizers.
Courtesy, honor or honour and due regard should compel you to follow strictly those instructions because they are not for show. They are for a reason, particularly to add color or colour to their day. You do not want to be classified as unkind and selfish because of your "no regard" for dress code instructions. Correct?