7 ms·
This is ugly, but it should do the job: "#000000" if sum([int(i,16) for i in re.findall("..",myColour)]) > 382.5 else "#ffffff"
by xhuang 16y ago
This is ugly, but it should do the job:
"#000000" if sum([int(i,16) for i in re.findall("..",myColour)]) > 382.5 else "#ffffff"