This blog gets a lot of search hits for things like "hanky code" and "flagging hunter green" and things like that, so for those of you stumbling across this in your search for flagging information, here is a short, quick guide to flagging.
First, a disclaimer, flagging does change from region to region and subculture to subculture (flagging in queer circles is different from flagging in Leather circles, and that's different from flagging in mainstream gay circles, etc). So just be careful of that. My knowledge is all from Australian flagging, and the closest thing we have to global Leather flagging (thanks to the internet!).
Flagging can be done with hankies (or bandannas), keys, chains, leather straps, cuffs, or ribbons. You can also use other things, of course, but the chances of it being recognized as a flag is lower than it is for these items.
To flag as a top, the item goes on your left. To flag as a bottom, the item goes on your right. To flag as a switch, the item goes in the middle.
There's also the issue of flagging via your neck - in some cases, this simply means switch, but in other cases it means hardcore. You can still flag left or right if you tie a hanky around your neck - the knot goes on the side that you're flagging. In short, be cautious when flagging with your neck.
Some other notes about flagging, before we get to colours:
If you're flagging with keys, some people take keys out to mean "available" and keys tucked into your pocket to mean "unavailable".
You can also flag switch by wearing two of whatever, one on each side. This is most commonly seen with cuffs or leather straps.
Be aware of the culture you're flagging in. You can probably flag whatever and however you like at a queer event, but if you're going to a Leather event make sure your hankies are clean and ironed, and that you're not flagging too many (maximum of two).
Now, about colours.
There are a million lists on the internet about hanky code colours (here are a couple: [link one] and [link two]) so I'm not going to list them all.
Now, some are more common than others. By all means flag whatever you like, but be aware that if it's an obscure one, then people may not know what you're flagging. Not everyone has the entire list memorized, for good reason :) Also the need to know the whole list is unnecessary; you generally only have to know the ones you're into.
Now let's talk about where to get items to flag with.
Most of the things I mentioned are easy to get (like ribbons and chains) or you already have (like your keys). Actual hankies, well, you can get them wherever you like too. I can't speak for other countries but here in Australia there's a certain type of bandanna that is the most common form of colour hanky flagging.
You can get bandannas specifically for flagging from most Leather & BDSM stores here in Australia. Here in Melbourne, mine came from Mannhaus, and I have also seen them at Eagle Leather and Lucrezia De Sade.
On a final note, I've already mentioned different cultures around flagging. Again, I can't speak for anywhere but here, but in the Leather culture here, it is common for hankies to be earned like leathers. They are often given as a gift for actually doing the thing that it flags, and doing it well. Your mileage may vary.
So that's that - I know that's a lot of information, but no one can claim that my introductions aren't thorough. :)