In vomiting scenes, the liquid is censored by rainbow, mosaics or bright light. Why do they censor puke? Blood shedding, killing, fighting, taking alcohol, bad language, nudity (without showing genitals), vandalism, etc are almost never censored. Why is vomiting treated like this?
Simply put, nobody wants to see the vomit of anyone as it is so creepy and disgusting that even children will not like it.
There can be many reasons behind this:
1. Gross and disgusting or creepy
According to me, no one wants see any character who is simply vomiting and taking out all his food.
The vomit chain reaction
It's like when one character vomits then those standing near them also start vomiting. Like as shown in this link,
This is Truth in Television, since vomiting has been known to inspire vomiting, as part of a prehistoric instinct: if someone from your same tribe vomits because he ate something harmful, chances are you ate the same thing and therefore it's best if you hurl it too.
And this thing happens in real life. There are many people who really vomit in this situation and there is this link which shows why we vomit when we see something gross. Which perfectly defines that there are some people who don't like watching some vomiting scene and for the safety of viewers they censor it just because they are creepy and disgusting.
2. For comedy
Since it is disgusting, that's why to make it a bit funny or comedic, they add rainbow puke which looks kind of fine.
3. For safety viewers and broadcasting restriction
Also there might be the possibility of broadcasting restrictions as they don't want any unnecessary problem. They might think that vomit scenes might not be good for children, so to make it safe for viewers, they censor it. I am not sure but they may have shown vomiting scenes in late night anime.
Still, there are so many anime which shows characters vomiting, like in:
Before the deployment in Episode 5 of Attack on Titan, soldiers are shown to vomit due to stress.
In the un-edited versions of Dragon Ball Z, Gohan kicks Cell in the stomach so hard he causes him to puke up Android 18, along with lots of acid.
And there are many more.
As far as killing someone or blood is concerned, then nowadays these things are pretty much common and only few people are afraid of these scenes. And if they start censoring these scenes of blood and killing, then there is no action (until and unless it's not harsh).
If it comes to nudity, then there are some Vanilla series anime which don't censor anything as they are categorized as adult stuff or late night anime (I am also not sure about anything regarding this). They don't censor late night anime only because no children are watching them at night time.
These are all memes, or else a progression and mutation of a single meme. There's no requirement to censor vomit, but it's done both for comedic effect and to maintain the aesthetic (no visceral imagery).
The mosaic barf was an extension of the meme where mosaics are used to hide or even just imply something too gross to look at. That meme is still used for bad cooking sometimes. That in itself isn't really funny, but eventually someone came up with colored sparkle barf (I think it was korezom first?) and full on rainbow barf followed very soon after, rapidly becoming a successful meme.