I believe that variations in uniform between soldiers in a company, and even in regiments, became increasingly less common.
Especially by the Napoleonic period, but even before that, during the wars in the 1700s.
However, each regiment did wear a slightly different uniform then the other regiments.
They would have different cuffs and collars, sometimes they would go so far as to add something different to the uniform.
But these were intentional,
Whereas it was punishable if your uniform was not the same as your company's.