Thin films of rare-earth (RE)-oxygen-hydrogen compounds prepared by reactive magnetron sputtering show a unique color-neutral photochromic effect at ambient conditions. While their optical properties have been studied extensively, the understanding of the relationship between photochromism, chemical composition, and structure is limited. Here we establish a ternary RE-O-H composition-phase diagram based on chemical composition analysis by a combination of Rutherford backscattering and elastic recoil detection. The photochromic films are identified as oxyhydrides with a wide composition range described by the formula REO x H 3-2x where 0.5 ≤ x ≤ 1.5. We propose an anion-disordered structure model based on the face-centered cubic unit cell where the O 2- and H - anions occupy tetrahedral and octahedral interstices. The optical band gap varies continuously with the anion ratio, demonstrating the potential of band gap tuning for reversible optical switching applications.