Traps work by catching pests, either some distance from the crop or where the pest normally occurs. The trap may consist of a sticky substance placed in the path of a pest so that it becomes stuck or it may be a container with a lure inside which will attract the pest inside, where it can be collected later.
Yellow attracts many insects (eg aphids). Yellow cards coverds with something sticky (eg honey) will attract insects which are then stuck to the card surface. The cards are periodically collected, burnt & replaced with new ones. other colours will attract different pasts, eg white will attract thrip.