The replacement of bulk refractive optical elements with diffractive planar components enables the miniaturization of optical systems. However, diffractive optics suffers from large chromatic aberrations due to the dispersion of the phase accumulated by light during propagation. We show that this limitation can be overcome with an engineered wavelength-dependent phase shift imparted by a metasurface and demonstrate a design that deflects three wavelengths without dispersion. A planar lens without chromatic aberrations at three wavelengths is also presented. Our design is based on low-loss dielectric resonators which introduce a dense spectrum of optical modes to enable dispersive phase compensation. The suppression of chromatic aberrations in metasurface-based planar photonics will find applications in lightweight collimators for displays, and chromatically-corrected imaging systems.