Color logic in the setColorFlag method