This report aims to explore the possibility of using graphyne derivatives as UV-light protector. Boron (B) and nitrogen (N) atoms are systematically substituted into the structures, and we find that BN-substituted analogs exhibit distinct characteristics compared with their parent two-dimensional structure. Due to the presence of BN at different sites, the optical band gap is tuned from infrared to UV via visible region depending on substitution sites. These findings will lead the way to utilize these BN doped structures in various optoelectronic applications such as in hybrid solar cell, electroluminescence cell, light emitting cell, and as selective electromagnetic radiation absorber. The origin of this tunable optical response and band gap is explained in the light of partial density of states analysis and electron density distribution. The presence of strong absorption peak in UV region indicates that these materials may be used as an excellent candidate for UV light protection.