title: Good text foreground color for a given background color
body: <p>I'm drawing a color selection button and I'm looking for a nice and simple formula to get a good text color (foreground) for a given background color in RGB.  </p>
  
  <p>A simple try would be to just take the complement color but this will produce an odd looking button for colors like pure blue or pure red.<br>
  Is there something well known that does this?  </p>
  
  <p>If it matters at all, I'm using QT.</p>