check if color is valid since we segfault here if it is not