Perfect GaN is a colorless, transparent crystal. However, because of intentional and unintentional impurities, GaN crystals have colors and lose some transparency. O impurities are generally considered to be the origin of the coloration. In this paper, electronic structures of GaN that include O-related point and complex defects were analyzed using first-principles calculations to investigate their influence on the optical properties of GaN. It is found that the defect levels due to native point defects of Ga and N vacancies were compensated by O and H impurities, as well as divalent (Mg and Zn) and tetravalent (Si, Ge, and Sn) metal impurities.