Optimizing clearing of color memory