there's no scripture commanding that folks never wear hats.
there is however one forbidding men to wear them during liturgy; one that protestants ignore because it doesn't fit their traditions.
Let no man therefore judge you in meat, or in drink, or in respect of an holyday, or of the new moon, or of the sabbath days:
2:17 Which are a shadow of things to come; but the body is of Christ.