Blanching fresh basil leaves before preparing pesto for maximum 15 seconds can prevent the color turning, but you risk a loss of flavor. Consider adding a portion of baby spinach, which doesn't oxidize, along with the basil, and/or store basil with a thin layer of olive oil on the top surface to prevent air from reaching the pesto and muddying the color.