In this work, we report a versatile approach to two-dimensional colloidal patterning based on the lateral assembly of colloidal particles by an alternating electric field (AEF). Under the AEF, the lithographically templated electrodes provide an effective way to reversibly and rapidly assemble colloidal particles into some desirable patterns. By controlling the AEF and the electrode pattern geometry, various colloidal patterns with tunable lattice spacing and even with binary lattice spacing have been formed. Particularly, we demonstrate that well-defined linear defects can be embedded inside the colloidal crystals, whereas the unwanted existing defects can be controllably relaxed by this patterning process. This novel patterning technique is amenable to both large scale on-chip patterning and micro-structural control with single-particle resolution on a time scale of seconds. Furthermore, it introduces a new class of colloidal structures with the properties that can be finely tuned, reversibly switched, or permanently fixed, opening a new way for the engineering of novel materials and devices at micro levels.