We analyse a z < 0.1 galaxy sample from the Sloan Digital Sky Survey focusing on the variation in the galaxy colour bimodality with stellar mass and projected neighbour density Σ, and on measurements of the galaxy stellar mass functions. The characteristic mass increases with environmental density from about 1010.6 to (Kroupa initial mass function, H0= 70) for Σ in the range 0.1–10 Mpc−2. The galaxy population naturally divides into a red and blue sequence with the locus of the sequences in colour–mass and colour–concentration indices not varying strongly with environment. The fraction of galaxies on the red sequence is determined in bins of 0.2 in log Σ and bins). The red fraction fr generally increases continuously in both Σ and such that there is a unified relation: . Two simple functions are proposed which provide good fits to the data. These data are compared with analogous quantities in semi-analytical models based on the Millennium N-body simulation: the Bower et al. and Croton et al. models that incorporate active galactic nucleus feedback. Both models predict a strong dependence of the red fraction on stellar mass and environment that is qualitatively similar to the observations. However, a quantitative comparison shows that the Bower et al. model is a significantly better match; this appears to be due to the different treatment of feedback in central galaxies.