The bimodal galaxy distribution in the optical colour–magnitude diagram ( CMD ) comprises a narrow “ red sequence ” populated mostly by early-type galaxies and a broad “ blue cloud ” dominated by star-forming systems . Although the optical CMD allows one to select red sequence objects , neither can it be used for galaxy classification without additional observational data such as spectra or high-resolution images , nor to identify blue galaxies at unknown redshifts . We show that adding the near ultraviolet colour ( GALEX NUV \lambda _ { \mbox { eff } } = 227 nm ) to the optical ( g - r vs M _ { r } ) CMD reveals a tight relation in the three-dimensional colour–colour–magnitude space smoothly continuing from the “ blue cloud ” to the “ red sequence ” . We found that 98 per cent of 225 000 low-redshift ( Z < 0.27 ) galaxies follow a smooth surface g - r = F ( M _ { r } ,NUV - r ) with a standard deviation of 0.03–0.07 mag making it the tightest known galaxy photometric relation given the \sim 0.9 mag range of k -corrected g - r colours . Similar relations exist in other NUV–optical colours . There is a strong correlation between morphological types and integrated NUV - r colours of galaxies , while the connection with g - r is ambiguous . Rare galaxy classes such as E+A or tidally stripped systems become outliers that occupy distinct regions in the 3D parameter space . Using stellar population models for galaxies with different star formation histories , we show that ( a ) the ( NUV - r,g - r ) distribution at a given luminosity is formed by objects having constant and exponentially declining star formation rates with different characteristic timescales with the red sequence part consistent also with simple stellar population ; ( b ) colour evolution for exponentially declining models goes along the relation suggesting a weak evolution of its shape up-to a redshift of 0.9 ; ( c ) galaxies with truncated star formation histories have very short transition phase offset from the relation thus explaining the rareness of E+A galaxies . This relation can be used as a powerful galaxy classification tool when morphology remains unresolved . Its mathematical consequence is the possibility of precise and simple redshift estimates from only three broad-band photometric points . We show that this simple approach being applied to SDSS and GALEX data works better than most existing photometric redshift techniques applied to multi-colour datasets . Therefore , the relation can be used as an efficient search technique for galaxies at intermediate redshifts ( 0.3 < Z < 0.8 ) using optical imaging surveys .