new function to apply color