(WHTM) — Picture yourself outside enjoying a summer evening on your patio. String lights are all around you as you enjoy the beautiful weather.

Then as soon as you turn those lights on, you start to see a swarm of bugs that makes you want to go back inside the house.

So, why does this happen? Why do bugs love to swarm any sort of light source?

The Farmer’s Almanac says it has something to do with bugs being positively phototactic. That is a fancy way of saying the bugs instinctively move toward the light. If an insect instinctively moves away from light, they are negatively phototactic.

Though scientists do not know for sure why bugs are positively phototactic, some believe insects use the moonlight as a navigational tool. The moon stays in a fixed position overhead, so the insects know where to go.

When you turn on a light, the insects see that as another moon of sorts and go toward it.

But why does a bug keep flying around the same light for minutes at a time?

It has to do with temporary night blindness, a problem humans also have. If you stand in a brightly lit room, then suddenly shut off the lights, you experience a few seconds of blindness as your eyes adjust.

Some insect eyes, such as those found on moths, can take up to 30 minutes to adjust to the darkness after being exposed to the light. As a moth or other insect flies around a lightbulb, the bright light confuses it. But at the same time, the moth doesn’t want to fly into the darkness because it will be blind to dangers for up to half an hour.

If you want to keep the bugs away at night, the Farmer’s Almanac suggests that you can try yellow or red lights. Some insects may be attracted to those lights, but not nearly as much as they would be to white lights.