A hungry mosquito can sense the carbon dioxide a person exhales from 100 feet away, and a new study reveals that the gas triggers the insect’s visual system to pinpoint human skin tones.

“The odor is just telling them that something is out there, but their vision is telling them where it could be located,” says University of Washington neurobiologist Jeff Riffell, lead author of the study in Nature Communications. Tracking 1.3 million mosquito trajectories, his team found that the insects are drawn to red and orange light (which human skin prominently reflects, regardless of race) and avoid most greens and blues—but only in the presence of CO2.

Observing mosquitoes is hard; they dart through the air in quick, chaotic patterns. Researchers typically examine them in small boxes, but that “doesn’t recapitulate their natural behaviors,” Riffell says. To simulate a more realistic environment, Riffell’s team built a seven-foot-long mosquito wind tunnel that could control wind speed, odors and visual stimuli with exquisite precision. Along the tunnel’s edge, 16 cameras captured live video that was stitched together to reveal each insect’s flight path.

When Aedes aegypti mosquitoes were released into the tunnel, they did not investigate objects colored to match human skin until carbon dioxide was added. When it was, the mosquitoes flocked to the objects. Filtering out orange and red light halted the attraction. In another experiment, the researchers introduced mutations in the mosquitoes’ photoreceptors to suppress their vision for longer light wavelengths like red. This also stopped their swarming toward human skin tones, as did mutating a CO2-sensing receptor.

“Given that mosquitoes do not have a separate red-sensitive receptor,” says Almut Kelber, a sensory biologist at Sweden’s Lund University who was not involved in the research, it seems likely “that orange, red and black are all seen as dark and that the choice is not for ‘red’ but for ‘not green or blue.’

Other insects also use smell to cue visual preference. Female Asian swallowtail butterflies, for instance, “make color choices depending on the odor,” Kelber says. In a laboratory setting without scents, they preferentially land on blue objects. But when swallowtails smell a larval host plant to lay eggs on, she adds, they move toward green. Smelling oranges or lilies shifts their preference to red.

Riffell plans to extend his findings to develop better mosquito traps. Many traps have white components, he says: “And mosquitoes do not like white at all.”