Context. Future instruments like the Near Infrared Camera (NIRCam) and the Mid Infrared Instrument (MIRI) on the James Webb Space Telescope (JWST) or the Mid-Infrared E-ELT Imager and Spectrograph (METIS) at the European Extremely Large Telescope (E-ELT) will be able to image exoplanets that are too faint (because they have a low mass, and hence a small size or low effective temperature) for current direct imaging instruments. On the theoretical side, core accretion formation models predict a significant population of low-mass and/or cool planets at orbital distances of ∼ 10-100 au. Aims. Evolutionary models predicting the planetary intrinsic luminosity as a function of time have traditionally concentrated on gas-dominated giant planets. We extend these cooling curves to Saturnian and Neptunian planets. Methods. We simulated the cooling of isolated core-dominated and gas giant planets with masses of 5 M ⊕ to 2 M . The planets consist of a core made of iron, silicates, and ices surrounded by a H/He envelope, similar to the ice giants in the solar system. The luminosity includes the contribution from the cooling and contraction of the core and of the H/He envelope, as well as radiogenic decay. For the atmosphere we used grey, AMES-Cond, petitCODE, and HELIOS models. We considered solar and non-solar metallicities as well as cloud-free and cloudy atmospheres. The most important initial conditions, namely the core-to-envelope ratio and the initial (i.e. post formation) luminosity are taken from planet formation simulations based on the core accretion paradigm. Results. We first compare our cooling curves for Uranus, Neptune, Jupiter, Saturn, GJ 436b, and a 5 M ⊕ planet with a 1% H/He envelope with other evolutionary models. We then present the temporal evolution of planets with masses between 5 M ⊕ and 2 M in terms of their luminosity, effective temperature, radius, and entropy. We discuss the impact of different post formation entropies. For the different atmosphere types and initial conditions, magnitudes in various filter bands between 0.9 and 30 micrometer wavelength are provided. Conclusions. Using blackbody fluxes and non-grey spectra, we estimate the detectability of such planets with JWST. We found that a 20 (100) M ⊕ planet can be detected with JWST in the background limit up to an age of about 10 (100) Myr with NIRCam and MIRI, respectively. which are the gravitational potential energy of the gaseous envelope E grav,e , its thermal (internal) energy E int,e , the potential energy of the core E grav,c , and finally its thermal energy E int,c .