Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Calculating Color Contrast for Legible Text in Ruby.
'#000' if int(my_color, 16) > 0xffffff/2 else '#fff'
This approach isn't perfect, but it does the job.
"#000000" if sum([int(i,16) for i in re.findall("..",myColour)]) > 382.5 else "#ffffff"
'#000' if int(my_color, 16) > 0xffffff/2 else '#fff'
This approach isn't perfect, but it does the job.