In the world of invertebrates, black and yellow signals danger. It says to predators: I am poisonous or I will bite you.
It appears that black and yellow is an attention grabbing contrast no matter if you have compound vision, no colour vision at all, or see the world through a part of the spectrum that isn’t visible to humans. Black and yellow seems to be a heads-up to invertebrates and the many species that prey on them.
A bumble bee warning that it can sting and a biter and a sucker of blood.
It is an anti-predator adaptation, a warning signal that has become associated with the cost that a certain prey item might inflict on a predator; a reason to pause before attacking. The black and yellow signal is actually beneficial for both the prey and the predator, since it helps both avoid harm: a double evolutionary pressure.
A cinnabar caterpillar advertising that it is poisonous and a foul tasting ladybird.
There is a third category of invertebrates that wear black and yellow. They are not biters and stingers or nasty tasting and poisonous; they are mimics. Predators have learned to approach black and yellow prey with caution; some species have taken advantage of this, and wear the danger signals when they are, in fact, harmless.
These are harmless mimics, using the yellow and black colouration to scare away predators.
If you asked a child what colour signals danger, it would probably choose red. But humans, who share 60% of their DNA with invertebrates and often respond to instincts that are a lot older than their species, use black and yellow to warn of the really serious dangers.
Wasp Beetle by Keith Edkins
Other pictures CC0