I am glad to already have that sticker because I drive to Germany regularly, but it always stupefied me as what the exact rules are.
The colour of sticker depends on what emissions standard your vehicle meets.
For petrol it's nice and simple: No catalytic converter (i.e. using Leaded or Lead Replacement petrol) means you don't get a sticker. If you've got a cat (i.e. own a car manufactured from 1993 onwards), you get a Green sticker.
For diesel it's more complex: If your vehicle doesn't meet at least Euro II standards, you don't get a sticker; Euro II you get Red; Euro III you get Yellow; and Euro IV or higher you get Green.
At the entrance to each Environmental Zone, there'll be a sign telling you what colour sticker you need to legally enter it. This will either be Green; Yellow or Green; or Red, Yellow or Green. Enter with the wrong colour (or no sticker at all) and you're liable to a fixed penalty.
The sticker is specific to your vehicle and doesn't expire...and can be obtained at a Vehicle Testing Centre in Germany for 5€.