  We combine LAMOST DR7 spectroscopic data and Gaia EDR3 photometric data to
construct high-quality giant (0.7 $< (BP-RP) <$ 1.4) and dwarf (0.5 $< (BP-RP)
< $ 1.5) samples in the high Galactic latitude region, with precise corrections
for magnitude-dependent systematic errors in the Gaia photometry and careful
reddening corrections using empirically determined color- and
reddening-dependent coefficients. We use the two samples to build
metallicity-dependent stellar loci of Gaia colors for giants and dwarfs,
respectively. For a given $(BP-RP)$ color, a one dex change in [Fe/H] results
in about a 5 mmag change in $(BP-G)$ color for solar-type stars. These
relations are used to determine metallicity estimates from EDR3 colors. Despite
the weak sensitivity, the exquisite data quality of these colors enables a
typical precision of about $\delta$\,[Fe/H] = 0.2 dex. Our method is valid for
FGK stars with $G \leq 16$, [Fe/H] $\geq -2.5$, and $E(B-V) \leq 0.5$. Stars
with fainter $G$ magnitudes, lower metallicities, or larger reddening suffer
from higher metallicity uncertainties. With the enormous data volume of Gaia,
we have measured metallicity estimates for about 27 million stars with 10 $< G
\leq 16$ across almost the entire sky, including over 6 million giants and 20
million dwarfs, which can be used for a number of studies. These include
investigations of Galactic formation and evolution, the identification of
candidate stars for subsequent high-resolution spectroscopic follow-up, the
identification of wide binaries, and to obtain metallicity estimates of stars
for asteroseismology and exoplanet research.

Solar and Stellar Astrophysics;Astrophysics of Galaxies