added error handling for color codes