move color codes to function