I have never heard of any kind of "law". There are however warnings from the helmet manufacturer that is usually on the helmet. This is to cover their ars, plain and simple. If you paint their helmet and the user dies from a result of the helmet failing, the manufacturer is off the hook. You have "modified" the helmet, it was not used as per the manufacturers recommendations.
That is the only reference to a "law" in regard to painting a helmet that I have ever seen.