Artificial intelligence reveals environmental constraints on colour diversity in insects