Madam, The Court will ask you one more time, and for the last time ,”Would you please take those rags off your head in my courtroom?” Thank you in advance, for your compliance!
As far as I know, in the Courtroom, The Judge is King for the duration of the courtroom session, and he does have that ability to set dress code specifications.
A judge in Ft. Lauderdale jailed a female attorney for wearing culottes in his courtroom some years ago.