Bugs are attracted to white lights because
They use the moon or sun
As part of their navigation.
One can always fly towards the moon,
But never reach it.
But if one flies towards a white lightbulb,
Keeping it in the corner of the eye,
One keeps flying towards it from any angle.
Yellow light is less attractive to bugs,
Perhaps because it is a component of flames,
Or perhaps because it is often a component of reflected light,
As from grass.
Yaacov David Shulman