It’s somewhat complicated, but there are charts to boil it down a bit. Assuming you’re using LEDs and are at a fairly normal altitude, here’s a pretty decent chart:
-chart courtesy of @Alaskagrown
Basically, aim for the green for seedlings and the first few weeks, the blue for late veg until flowers have just started showing, and the purple for full flowering.