In this paper, an in-loop color space transform is proposed for screen content video coding to improve coding efficiency. The transform converts the color space of an input block to a better color space to improve rate-distortion performance by decorrelating among color components. Specifically, to derive the optimal color transform the principal component analysis is performed using spatially or temporally adjacent pixels in each block, and the derived transform is applied to the residual samples after intra or inter prediction. Then, rate-distortion optimization is performed to select the better color space between the original color space of the input signal and the derived one. It is demonstrated with the experimental results that the proposed method provides significant coding gains.