Coalescence of neutron stars gives rise to kilonova , thermal emission powered by radioactive decays of freshly synthesized r -process nuclei . Although observational properties are largely affected by bound-bound opacities of r -process elements , available atomic data have been limited . In this paper , we study element-to-element variation of the opacities in the ejecta of neutron star mergers by performing systematic atomic structure calculations of r -process elements for the first time . We show that the distributions of energy levels tend to be higher as electron occupation increases for each electron shell due to the larger energy spacing caused by larger effects of spin-orbit and electron-electron interactions . As a result , elements with a fewer number of electrons in the outermost shells tend to give larger contributions to the bound-bound opacities . This implies that Fe is not representative for the opacities of light r -process elements . The average opacities for the mixture of r -process elements are found to be \kappa \sim 20 - 30 { cm ^ { 2 } g ^ { -1 } } for the electron fraction of Y _ { e } \leq 0.20 , \kappa \sim 3 - 5 { cm ^ { 2 } g ^ { -1 } } for Y _ { e } = 0.25 - 0.35 , and \kappa \sim 1 { cm ^ { 2 } g ^ { -1 } } for Y _ { e } = 0.40 at T = 5 , 000 - 10 , 000 K , and they steeply decrease at lower temperature . We show that , even with the same abundance or Y _ { e } , the opacity in the ejecta changes with time by one order of magnitude from 1 to 10 days after the merger . Our radiative transfer simulations with the new opacity data confirm that ejecta with a high electron fraction ( Y _ { e } \mathrel { \hbox to 0.0 pt { \lower 4.0 pt \hbox { $ \sim$ } } \raise 1.0 pt \hbox { $% > $ } } 0.25 , with no lanthanide ) are needed to explain the early , blue emission in GW170817/AT2017gfo while lanthanide-rich ejecta ( with a mass fraction of lanthanides \sim 5 \times 10 ^ { -3 } ) reproduce the long-lasting near-infrared emission .