We present new optical and near-infrared imaging for a sample of 98 spectroscopically selected galaxy groups at 0.25 < z < 0.55, most of which have velocity dispersions σ < 500 km s−1. We use point spread function matched aperture photometry to measure accurate colours for group members and the surrounding field population. The sample is statistically complete above a stellar mass limit of approximately M= 1 × 1010 M⊙. The overall colour distribution is bimodal in both the field and group samples; but, at fixed luminosity the fraction of group galaxies populating the red peak is larger, by ∼20 ± 7 per cent, than that of the field. In particular, group members with early-type morphologies, as identified in Hubble Space Telescope imaging, exhibit a tight red sequence, similar to that seen for more massive clusters. Using optical and near-infrared colours, including data from the Spitzer Space Telescope, we show that approximately 20–30 per cent of galaxies on the red sequence may be dust-reddened galaxies with non-negligible star formation and early-spiral morphologies. This is true of both the field and group samples, and shows little dependence on near-infrared luminosity. Thus, the fraction of bright (0.4MK < −22) group members with no sign of star formation or active galactic nuclei activity, as identified by their colours or [O ii] emission, is 54 ± 6 per cent. Our field sample, which includes galaxies in all environments, contains 35 ± 3 per cent of such inactive galaxies, consistent with the amount expected if all such galaxies are located in groups and clusters. This reinforces our earlier conclusions that dense environments at z≲ 0.5 are associated with a premature cessation of star formation in some galaxies; in particular, we find no evidence for significantly enhanced star formation in these environments. Simple galaxy formation models predict a quenching of star formation in groups that is too efficient, overpopulating the red sequence. Attempts to fix this by increasing the time-scale of this quenching equally for all group members distort the colour distribution in a way that is inconsistent with observations.