We develop a computationally efficient scheme to accurately determine finite-temperature band gaps. We here focus on materials belonging to the class ABX 3 (A = Rb, Cs; B = Ge, Sn, Pb; and X = F, Cl, Br, I), which includes halide perovskites.First, an initial estimate of the band gap is provided for the ideal crystalline structure through the use of a range-separated hybrid functional, in which the parameters are determined nonempirically from the electron density and the high-frequency dielectric constant. Next, we consider two kinds of band-gap corrections to account for spin-orbit coupling and thermal vibrations including zero-point motions. In particular, the latter effect is accounted for through the special displacement method, which consists in using a single distorted configuration obtained from the vibrational frequencies and eigenmodes, thereby avoiding lengthy molecular dynamics. The sequential consideration of both corrections systematically improves the band gaps, reaching a mean absolute error of 0.17 eV with respect to experimental values. The computational efficiency of our scheme stems from the fact that only a single calculation at the hybrid-functional