fix logic for deciding tab colors