I think that regarding Tuaregs, this explanation may be correct;
“If it were about the hot desert sun, white clothing would be better because it simply reflects away the heat and light. Everyone knows that a black surface gets hotter in the sun than a white or reflective surface. Far better for the cloth to not get hot at all, than for it to absorb heat and get hot and then have to insulate it from the body with more layers of inner clothing.
In fact, the reason for dark clothing is heat transfer in the opposite ddirection - from the body to the outside.
The body absorbs heat from the environment and also produces a lot of heat internally through metabolism. White clothing would simply reflect this heat back, accumulating it next to your skin. But dark clothing absorbs body heat and allows it to escape into the atmosphere, keeping the wearer cool.
But this is a delicate balancing act, and only works if the rate of heat transfer from clothing to environment is faster than the rate at which the sun warms the clothing. The primary methods of losing heat are convection and radiation, and convection here tips the balance. In short, it works because high and constant desert winds cool the clothing at a fast enough rate. It would never work without wind, when white clothing would be cooler.
Tuareg dress is the result of millennia of adaptation to hot, windy desert environments.”