They are genetic – an adult sim with purple hair can have purple-haired offspring about 50% of the time, at the same ratio that other hair colors are passed onto children. All hair recolors are Maxis Match! My CC recolors add swatches to the original hair styles in the game, so that there won’t be two versions of each hairstyle/eyebrow in your menu – which I find annoying because it takes so much time to scan through them all that way.