Tuning the bandgap of double perovskites