In this paper, we deal with the problem of constrained code optimization for radar space-time adaptive processing (STAP) in the presence of colored Gaussian disturbance. At the design stage, we devise a code design algorithm complying with the following optimality criterion: maximization of the detection performance under a control on the regions of achievable values for the temporal and spatial Doppler estimation accuracy, and on the degree of similarity with a pre-fixed radar code. The resulting quadratic optimization problem is solved resorting to a convex relaxation that belongs to the semidefinite program (SDP) class. An optimal solution of the initial problem is then constructed through a suitable rank-one decomposition of an optimal solution of the relaxed one. At the analysis stage, we assess the performance of the new algorithm both on simulated data and on the standard challenging the Knowledge-Aided Sensor Signal Processing and Expert Reasoning (KASSPER) datacube.