We investigate color superconducting phases of cold quark matter at densities relevant for the interiors of compact stars. At these densities, electrically neutral and weak-equilibrated quark matter can have unequal numbers of up, down, and strange quarks. The QCD interaction favors Cooper pairs that are antisymmetric in color and in flavor, and a crystalline color superconducting phase can occur which accommodates pairing between flavors with unequal number densities. In the crystalline color superconductor, quarks of different flavor form Cooper pairs with nonzero total momentum, yielding a condensate that varies in space like a sum of plane waves. Rotational and translational symmetry are spontaneously broken. We use a GinzburgLandau method to evaluate candidate crystal structures and predict that the favored structure is face-centered-cubic. We predict a robust crystalline phase with gaps comparable in magnitude to those of the color-flavor-locked phase that occurs when the flavor number densities are equal. Crystalline color superconductivity will be a generic feature of the QCD phase diagram, occurring wherever quark matter that is not color-flavor locked is to be found. If a very large flavor asymmetry forbids even the crystalline state, single-flavor pairing will occur; we investigate this and other spin-one color superconductors in a survey of generic color, flavor, and spin pairing channels. Our predictions for the crystalline phase may be tested in an ultracold gas of fermionic atoms, where a similar crystalline superfluid state can occur. If a layer of crystalline quark matter occurs inside of a compact star, it could pin rotational vortices, leading to observable pulsar glitches.