Having spent the last few years working in Luton Museum, I know a bit about this Either the straw was dyed before it was plaited or the plaits were dyed before they were made up into hats. Chemical dyes were taken up rapidly after their invention mid-19th c., so all dyes used by the the 20th c. would be chemical.

If you have a natural straw hat and want to change the colour I'm not sure how you'd go about it as the straw will have been treated to protect it, and that may repel any dyes.

"Straw hat varnish" is available from various (artist) printmakers suppliers, but as far as I know, it comes in "light" and "dark" only. (It's methylated spirits-based, and used as a resist in some etching processes.)

BTW, wasn't there an Agatha Christie story where someone committed a murder by swapping hat varnish for somebody's medicine?