Effect of magnetic ordering on the optical properties of transition-metal halides: Ni Cl 2 , Ni Br 2 , Cr Cl 3 , and Cr Br 3