In an era of extensive photometric observations, the catalogs of RR Lyr type variable stars number tens of thousands of objects. The relation between the iron abundance [Fe/H] and the Fourier parameters of the stars light curve allows us to investigate mean metallicities and metallicity gradients in various stellar environments, independently of time-consuming spectroscopic observations. In this paper we use almost 6500 $V$- and $I$-band light curves of fundamental mode RR Lyr stars from the OGLE-IV survey to provide a relation between the $V$- and $I$-band phase parameter $varphi_{31}$ used to estimate [Fe/H]. The relation depends on metallicity, which limits its applicability. We apply this relation to metallicity formulae developed for the Johnson $V$- and the Kepler $Kp$-band to obtain the relation between [Fe/H] and $varphi_{31}$ for the $I$-band photometry. Last, we apply the new relation of Nemec to the OGLE-IV fundamental mode RR Lyr stars data and construct a metallicity map of the Magellanic Clouds. Median [Fe/H] is $-1.39pm0.44$ dex for the LMC and $-1.77pm0.48$ dex for the SMC, on the Jurcsik metallicity scale. We also find a metallicity gradient within the LMC with a slope of $-0.029pm0.002$ dex/kpc in the inner 5 kpc and $-0.030 pm0.003$ dex/kpc beyond 8 kpc, and no gradient in-between ($-0.019pm0.002$ dex/kpc integrally). We do not observe a metallicity gradient in the SMC, although we show that the metal-rich RRab stars are more concentrated toward the SMC center than the metal-poor.