Ignoring the inconsistent portrayal in the shows...
CHAKOTAY: One more thing. I'd appreciate it if you'd shave and change back into your uniform. We do have protocols. - Voy: Alice
... the best source I've been able to locate for these fabled Starfleet protocols on dress and grooming is from the "Starfleet Dynamics: Starfleet Academy Training Manual":
Your dress and conduct should always reflect credit upon yourself,
Starfleet, and the United Federation of Planets. Your uniform should
be of high quality. It should be clean and worn properly.
Uniforms provided by Starfleet Quartermasters are regulation. If you
buy or have a uniform made elsewhere, you must ensure it is regulation
in pattern, appearance, and quality.
You must provide yourself with an adequate supply of correct uniforms.
It is up to you to ensure that your uniform is processed by the ship's
laundry fabricators, fit all times (except when authorized to wear
civilian clothes) you must wear the complete uniform prescribed for
Starfleet uniform regulations require that men keep faces shaven,
except that a short, neat moustache/beard is permitted. No unusual
beards or moustaches are permitted. Men must keep their hair neatly
and closely trimmed, length not to exceed seven centimetres. Women
must keep their hair neatly arranged, with back hair touching but not
falling below the collar. Side hair must be trimmed to show a close
Cosmetics must be conservative and in good taste. No articles such as
pens, jewellery, combs, or similar items may be worn or carried
exposed upon the uniform. Chronometers, identification bracelets,
inconspicuous rings, and conservative earrings are permitted. However,
no oddities of dress are permitted.
The dress uniform has several options available. For women, one such
variation is a skirt. This is a simple, tailored-cut, wrap-around
black skirt, available in three lengths: mini, knee-length, and
mid-calf. The skirt is worn with black stockings and standard issue
You may wish to note that this book is listed as a fan-work and although it was apparently written with the extensive involvement of the production staff of Star Trek VI, it's not an officially Paramount-licensed product (though somehow still managed to be sold commercially) so please take it with the appropriate number of pinches of salt.