Outdoors, a sweet potato weevil’s favorite color is red. Indoors, it’s green. You might not think that a pesky insect’s favorite color would be a matter of public concern. But for scientists trying to design the perfect weevil trap, it could mean the difference between saving a crop and seeing it destroyed.

Sweet potato weevils (Cylas formicarius) can be a ruinous problem. They burrow into sweet potatoes, laying their eggs in the stem and in the potato itself. Their larvae grow inside the plants, and as adults they chew their way out, continuing to feed on the leaves, stems and potatoes. The plants become yellowed and the potatoes inedible, squishy and riddled with holes. A large infestation could ruin the crop entirely. Even when harvested and stored, the sweet potatoes aren’t safe. The weevils will gnaw away at the sweet potatoes, making them useless for consumption or sale. That’s bad news for sweet potatoes, and the many humans who eat them.

Over much of the world, the sweet potato is far more than a colorful holiday dish. Sweet potatoes are the sixth most important food crop in the world (behind wheat, rice, maize, white potatoes and barley). And so sweet potato weevils are a critical problem, particularly in places where it is a staple food, such as the Pacific Islands. G.V.P. Reddy, an entomologist at Montana State University, started studying the issue while living in Guam. “The sweet potato was one of the most widely grown crops, and the situation drove me to work on them,” he says. “It’s kind of need-based research.” Controlling the weevil population could save a crop — and a farmer’s livelihood.

The most common method to control sweet potato weevils is with pesticides. But even eco-friendly pesticides like neem or spinosad aren’t particularly effective against the weevils. They might kill the adults, but the larvae, buried in the stem and tubers, survive to chew another day. Some more resistant strains of sweet potato have been developed but are not yet in widespread use.

Reddy has devoted the past few years to a different approach: Developing a weevil trap that’s both effective and environmentally friendly. Baited with artificial pheromones that mimic a female sweet potato weevil, a trap beckons lonely males to their doom. They crawl into the trap, where they can be easily dispatched with a little bit of soapy water. “Once you remove all the males,” Reddy says, “the females can’t mate and won’t lay eggs. The weevils can’t be eradicated, but they can be controlled.”

When you decide to trap weevils instead of using pesticide, things do not get simpler. Reddy and his colleagues have spent a lot of time figuring out the best trap height, shape and size to attract the most weevils. The insects are picky pests. In previous studies, Reddy and his colleagues found that a particular kind of trap, the medium-sized Pherocon unitrap, works best, better than square traps, triangular traps or traps that are basically plastic cups. Placement matters, too: In previous work published in the Journal of Chemical Ecology in 2012, the researchers found that they also get better results when the traps are above the sweet potato plants, rather than down among them, and that results are best when you bait the traps with plenty of pheromones to draw in the weevil boys.

Height, shape, size and pheromone smell — all of those things matter. But color could matter, too. “We knew that insects can respond to different colors,” Reddy says, “some use visual cues and some use olfactory. I believe the weevils are using both.”

The traps sold in agriculture stores are typically made of white and yellow plastic. Reddy and his colleagues modified the trap color using colored tape, making additional traps in brown, black, gray, red, green and blue. He found that red traps attracted nearly twice as many weevils as the white and yellow varieties.

But farmers also need weevil traps for indoor use, as the weevils can get indoors and ruin your harvest just as easily as in the field. Reddy assumed that the red colored traps would be the most effective indoors as well. But in results published in the January Annals of the Entomological Society of America, it turns out that when you let the weevils indoors, the same weevils have very different preferences in décor. Indoors, the weevils ignored the red, white, black, brown, gray or blue traps in favor of green.

Reddy’s next task is to figure out why this sudden change in color preference exists. “There are several possibilities,” he says. “The sunshine might have a reflection activity on traps in the field.” Weevils are usually nocturnal, but the pheromone-laced traps make them active during the day, when the sun shining on a trap might make a difference. He and his colleagues will be testing different wavelengths of light and other potential factors, such as temperature.

It’s all in the name of a better trap. Reddy hopes that his results will spur companies to change their trap colors to increase their effectiveness. The findings can even help sweet potato farmers right now. All of the colors Reddy and his colleagues used were colors of tape easily found in stores, and relatively cheap. Farmers could go out and change the colors of their traps without having to buy new ones. A little colored tape on your weevil trap could help ensure these insects do no weevil.