  We propose a new method for estimating the distances of molecular clouds
traced by CO line emission. Stars from 2MASS and Gaia EDR3 are selected as
on-cloud stars when they are projected on a cloud. The background on-cloud
stars have redder colors on average than the foreground stars. Instead of
searching for stars projected away from the cloud, we employed the TRILEGA
galaxy model to mimic the stellar population without cloud extinction along the
sightline toward the cloud. Our method does not require an exact boundary of a
cloud. The boundaries are highly variable and depend on the sensitivity of the
molecular line data. For each cloud, we compared the distributions of on-cloud
stars to the TRILEGAL stellar populations in the diagram of $J-K_s$ color
versus distance. The intrinsic $J-K_s$ colors of main-sequence and evolved
stars from TRILEGAL were considered separately, and they were used as the
baseline for subtracting the observed $J-K_s$ colors. The baseline-corrected
$J-K_s$ color was deployed with the Bayesian analysis and Markov chain Monte
Carlo sampling to determine the distance at which the $J-K_s$ color jump is
largest. This method was successfully applied to measure the distances of 27
molecular clouds, which were selected from previously published cloud samples.
By replacing TRILEGAL with the GALAXIA galaxy model, we were able to measure
the distances for 21 of the 27 clouds. The distances of the 21 clouds based on
the GALAXIA model agree well with those based on the TRILEGAL model. The
distances of the 27 clouds estimated by this method are consistent with
previous estimates. We will apply this new method to a larger region of the
gaseous galactic plane, in particular, for the inner galactic region, where a
region free of CO emission is hard to separate from the crowded field of
clouds.
