Ancient people opened brothels, the householder is mostly women, she presided over the brothel up and down, and the men are just serving tea, this kind of man himself as a brothel men, their heads wrapped in a green bandana, which is equivalent to their professional attire, and this is equivalent to the head of the tortoise, the king's head is green, so they are also known as the turtle male. Later it was used to denote a man whose wife serves someone else, and by extension a man whose wife cheats on him.
Therefore, Wei Xiaobao was called "son of a bitch" and "son of a turtle" in the Book of the Deer and the Tripod.
The "green hat" is the green turban, which is the same reason!