def YIQToRGB(y, i, q): red, green, blue = colorsys.yiq_to_rgb(y, i, q) return int(red * 0xff), int(green * 0xff), int(blue * 0xff) # Text-color heuristics: