ABSTRACT We present the conditional H i (neutral hydrogen) mass function (HIMF) conditioned on observed optical properties, Mr (r-band absolute magnitude), and Cur (u − r colour), for a sample of 7709 galaxies from Arecibo Legacy Fast ALFA (40 per cent data release – α.40) which overlaps with a common volume in SDSS DR7. Based on the conditional HIMF, we find that the luminous red, luminous blue, and faint blue populations dominate the total HIMF at the high-mass end, knee, and the low-mass end, respectively. We use the conditional HIMF to derive the underlying distribution function of ΩH i (H i density parameter), p(ΩH i), in the colour–magnitude plane of galaxies. The distribution, p(ΩH i), peaks in the blue cloud at $\mathit{ M_{{r}}}^{\text{max}}=-19.25, \mathit{ C_{{ur}}}^{\text{max}}=1.44$ but is skewed. It has a long tail towards faint blue galaxies, and luminous red galaxies. We argue that p(ΩH i) can be used to reveal the underlying relation between cold gas, stellar mass, and the star formation rate in an unbiased way, that is, the derived relation does not suffer from survey or sample selection.