Improve note colouring

- Make case insensitive
 - If not starts with key, it's a match

Fixes #71
This commit is contained in:
Keith Edmunds 2021-09-25 22:33:17 +01:00
parent ab858a62fd
commit 69dd0235a0

View File

@ -1032,10 +1032,9 @@ class PlaylistTab(QTableWidget):
# Set colour
note_colour = Config.COLOUR_NOTES_PLAYLIST
note_text = self.item(row, self.COL_TITLE).text()
note_tokens = note_text.split(":", 1)
if len(note_tokens) == 2:
if note_tokens[0] in Config.NOTE_COLOURS:
note_colour = Config.NOTE_COLOURS[note_tokens[0]]
for colour_token in Config.NOTE_COLOURS.keys():
if note_text.lower().startswith(colour_token.lower()):
note_colour = Config.NOTE_COLOURS[colour_token]
self._set_row_colour(
row, QColor(note_colour)
)