Purple strains are like a genetic variant in a plant. I have had a certain seed, for example Nightshade, that had green plants, and purple buds, and some that were green / green. Its like eye coloring in a human, some females and males genes mix a certain way to form these variants, resulting in purple bud. As well, there are strains you can purchase that have been genetically set up to produce purple buds exclusively, ex: purple haze (the real kind) usually seed manufacturers / growers will specify this condition.. That blacklight shit is highly incorrect that will do nothing, thats an old wives tale.
So.. I don't believe its been proven that stress and different conditions will produce this purple bud. But, I highly believe it is in the genetics of the plants and is like a variable, and if that variable is not consistently reproduced its just going to be random.