colours_to_filter = [] for coltype in allowed_colour_types: if coltype == 'ALL': for n in range(0, 215): colours_to_filter.append(n) break if coltype == 'GRAYSCALE': for n in range(1, 16): colours_to_filter.append(n) if coltype == 'METAL': for n in range(16, 24): colours_to_filter.append(n)