The usual vomit from the stomach is pale brown and sour. When your vomit contains the bile and other intestinal contents, it will be bright yellow to dark green and bitter.
Certain foods or spices, such as green leafy vegetables, fruit juices, carrots, curry or turmeric, and medicinal syrups can also color the vomit yellow or green.
Vomiting Green, Yellow or Orange Bile
1. Vomiting on an empty stomach, in the morning
When you are vomiting on an empty stomach, the bile from the upper part of the small intestine is usually the only thing that comes up and makes your vomit yellow, orange or green.
- Hangover after excessive alcohol drinking 
- Stress, anxiety 
- Morning sickness in pregnant women 
- Moderate to severe dehydration
- Food poisoning, intolerance or allergy 
- Migraine headache
- Medications (aspirin, antidepressants, antibiotics, morphine), iron supplements or chemotherapy for cancer 
Severe conditions :
- Pancreatitis or pancreatic cancer
- Liver cancer
- Kidney failure
- Adrenal insufficiency
- Labyrinthitis or other disorders of the inner ear
- Diabetic ketoacidosis
- Cyclic vomiting syndrome (mainly in children) 
- Brain tumor or bleeding, or brain swelling due to water intoxication
- Poisoning with pesticides, carbon monoxide or other toxins
2. Bile reflux
Bile reflux refers to frequent backflow of the bile from the intestine into the stomach, where it mixes with food and can trigger vomiting. Causes of bile reflux are listed below.
Stomach conditions :
- An ulcer or cancer in the lower part of the stomach
- Partial stomach removal
- Gastric bypass surgery for weight loss
- Acute cholecystitis 
- Gallbladder removal 
3. Intestinal obstruction (ileus) [1,5]
Increased pressure due to an intestinal obstruction can push the bile into the stomach. Common causes include:
- Severe constipation – fecal impaction
- Crohn’s disease
- Recent surgery
- Adhesions after abdominal surgery
- In infants:
- Congenital abnormalities
- Intestinal loops twisting (volvulus)
- In elderly:
- Colon cancer
- Chronic cholecystitis with gallbladder rupture and passage of gallstones into the intestine and its blockage 
NOTE: A newborn vomiting yellow or green contents should be checked by a doctor for an intestinal obstruction as soon as possible.
Vomiting Blood and Brown or Black Bile
The vomit can appear brown or black after consuming dark colored foods or beverages, such as chocolate, coffee or red wine, or after taking iron supplements or bismuth subsalicylate.
Some women report vomiting brown bile as part of morning sickness, which may be normal.
NOTE: Vomiting brown bile can result from intestinal obstruction (see above) or a bleeding stomach ulcer or cancer. The blood in the vomit can also appear black, like coffee grounds.
Vomiting Blue Bile
Green vomit may appear blue-green under certain lights . Green bile in the vomit can turn blue when reacting with detergents in the toilet or sink.
The vomit that is already blue when it comes out of your mouth can occur after the ingestion of blue colored beverages, candies or medications.
NOTE: Vomiting blue bile can also result from poisoning with copper sulfate (blue vitriol)  or antiseptics or pesticides that contain boric acid.
How to Stop Vomiting Bile
To reduce the risk of vomiting bile:
- Keep yourself well hydrated.
- Drink some plain water in the morning.
- Have frequent small meals.
- Avoid smoking [6,7].
- Avoid excessive alcohol drinking.
What to Eat After Vomiting Bile
After vomiting bile, do not eat for several hours to prevent further stomach irritation. Drink enough water or herbal tea to replace the fluid lost with vomiting and prevent dehydration.
Foods to avoid after vomiting bile:
- Alcohol, caffeinated and fizzy drinks and fruit juices
- Fatty foods: meat, oil, milk, cheese, eggs, chocolate
- Salty foods: canned foods, salty snacks, sauces, bagged soups
- Foods that cause bloating: legumes, oats, barley
- Spicy foods
You can try bland foods, such as:
- Whole grain bread
- Brown rice
- Green leafy vegetables
When To Visit a Doctor
When you are vomiting bile, and you can not think of an obvious cause, such as alcohol drinking or a migraine headache, visit a doctor, especially if you are experiencing:
- Vomiting brown or black bile
- Black stools
- Severe or persistent abdominal pain, diarrhea, headache, dizziness or fatigue
A doctor may suggest investigations, such as blood tests or upper endoscopy, to find a cause of vomiting bile.
Treatment depends on the underlying condition:
- Bile reflux can be treated with medications, such as baclofen , cisapride , domperidone  or ursodeoxycholic acid ; bile salt sequestrants, such as cholestyramine, are less effective .
- Intestinal obstruction often requires urgent surgical treatment.
- Intestinal obstruction, overview Mayo Clinic
- Cystic fibrosis Drugs.com
- Venkatesan T, Cyclic vomiting syndrome, clinical presentation Emedicine
- Abdominal migraine and cyclic vomiting syndrome The University of Chicago
- Intestinal obstruction MedlinePlus
- Valenzuela JE et al, 1976, Manometric studies on the human pyloric sphincter. Effect of cigarette smoking, metoclopramide, and atropine PubMed
- Read NW et al, 1973, Effect of Cigarette Smoking on Competence of the Pylorus: Preliminary Study PubMed Central
- Stefanivsky AB et al, 1985, Ursodeoxycholic acid treatment of bile reflux gastritis PubMed
- Bile reflux Drugs.com
- Cheifetz AS et al, Biliary reflux, Oxford American Handbook of Gastroenterology and Hepatology, p. 239
- Sifrim D, 2013, Bile reflux management PubMed Central
- Szarszewski A et al, 1999, Duodenogastric reflux: clinical and therapeutic aspects Archives of Disease in Childhood
- Vomiting Bile FastMed
- The difference between morning sickness and hyperemesis gravidarum HelpHER
- Medicines that can cause nausea and vomiting WebMD
- Bile reflux causes Mayo Clinic
- Wang Li et al, 2017, Gallstone ileus displaying the typical Rigler triad and an occult second ectopic stone: A case report Ovid
- Phelps K et al, 2011, General Practice: The Integrative Approach, p.406
- Medija J, 2005, Primary Clinical Care Manual
- Browse NL, 2005 Browse’s Introduction to the Symptoms & Signs of Surgical Disease 4th Edition, p.413
- Champika SSK Gamakaranage et al, 2011, Complications and management of acute copper sulphate poisoning; a case discussion PubMed Central
- Walker GM et al, 2006, Colour of bile vomiting in intestinal obstruction in the newborn: questionnaire study PubMed Central
- Fries WC, Anxiety, Stress, and Stomachaches; Excitement and stress can cause nausea and vomiting WebMD