3 ms·
I also had to do something like this for my Python project and ended up with this: '#000' if int(my_color, 16) > 0xffffff/2 else '#fff' This approach isn't pe
by azymm 16y ago
I also had to do something like this for my Python project and ended up with this:
'#000' if int(my_color, 16) > 0xffffff/2 else '#fff'
This approach isn't perfect, but it does the job.