Using first principles calculation, we systematically investigate the electronic modification of Cu-based chalcopyrite semiconductors induced by lattice deformation and composition alchemy. It is shown that the optical band gap E g is remarkably sensitive to the anion displacement µ, resulting from the opposite shifts of conduction band minimum and valence band maximum. Meanwhile, the dependence of structural parameters of alloyed compounds on alloy composition x is demonstrated for both cation and anion alloying. The d orbitals of group-III cations are found to be of great importance in the calculation. Abnormal changes in the optical band gap E g induced by anion alloying are addressed.