We're accustomed to seeing urine as yellow, or, if we're extremely hydrated, clear. That doesn't mean that pee can't have all kinds of colors. Let's explore the biochemistry of making one's pee all the colors of the rainbow.
Well, this is an easy one. It might be blood reddening your urine, in which case get to a hospital and stay there until they figure out how to treat you. It could be bladder cancer, or it might be something as relatively benign as kidney stones. On the other hand, it might be beets making your pee red, in which case, keep eating! They're low-calorie, high-fiber, and filled with vitamins. They're also filled with betanin — proof that not all food additives are bad. Betanin is harvested from beets and put into a few foods as red coloring. It only goes in frozen foods or foods meant to be eaten soon, as sunlight and oxygen degrade it. Betanin is a delicate dye, but a lot of people lack the enzyme that will break it down in their stomach. Those people have red or pink pee.
Again, this can be a problem. Bilirubin is a yellow-orange, and it's normally in urine. It's the product of the natural breakdown of the heme in hemoglobin. Too much, though, can indicate liver cancer. Alternately, you could have just taken some phenazopyridine. This is a drug given to people who have had procedures done on their urinary tract, or have some urinary tract irritation. When it makes its way through the body, it breaks down into components that kill pain in the mucosal lining of the urinary tract. Those components also turns your pee to orange sports drink, but this is harmless.
This one you can figure out on your own.
Pseudomonas aeruginosa is most common in healthcare settings, in part because it travels around hospitals, and in part because it's most present in people with compromised immune systems. This bacteria usually settles in the urinary tract, and makes everything that comes out of that tract, pus and pee, turn a bit green. Unless you're seriously dedicated to a pee rainbow, avoid this.
The best way to get blue urine is with blue dye. The body doesn't break down a lot of blue dyes, so even eating something blue can cause you to pee blue. I know one person who went to a Star Wars-themed bar and drank "blue milk." They were warned by their waitress that they'd be peeing blue, but there's nothing like a lot of blue milk to make you forget your waitress' warning.
There's also methylene blue. This substance was used to treat malaria about a century ago, and as resistance to drugs increases, and money available to treat malaria patients decreases, it might become the standard once again. The drawback is it causes both urine and the whites of one's eyes to turn blue. This only happens when the taker is fairly dehydrated. When diluted, methylene blue turns the urine a nice light green color that doesn't involve a urinary tract infection.
Phenolphthalein has a venerable history as a laxative, and an equally venerable history of turning people's urine into a purple-red color, but only if the urine is very slightly basic. The bad news is bacteria often turn urine alkaline. The good news is a vegetarian diet of fruits, legumes, and vegetables can also turn pee alkaline. So maybe you're not infected, you're just vegetarian. (Though how you managed to be vegetarian and constipated is anyone's guess.)
Just as a bonus, several different antibiotics, including metronidazole and methyldopa seem to turn urine black. But not to worry! These chemicals just turn black on contact with bleach, which is a popular option for cleaning toilet bowls. So the urine will only turn black outside the body.
[Via Why Does Eating Beets Turn My Pee Red, Phenazopyridine, Pseudomonas aeroginosa in Healthcare Settings, Abnormal Urine Color, Textbook of Medical Laboratory Technology, You Can Pee A Rainbow]