[comp.graphics] colour visibilty

rdb@oasis.icl.co.uk (Roger Binns) (06/06/91)

I have a little problem.  I have a foreground and background colour
specified as RGB values (0-255) and need to know if they will be visible
against each other.  If not, then I need a replacement colour that will be
visible against the background and a replacement background colour that
will be visible against the foreground.

By visible, I mean that text should be easily readable.  I can work it out
for elementary cases, but have no idea of say RGB(128, 93, 187) against
RGB(187, 64, 192).

Could any kind souls who have solved this please send me either the method
or the code (C preferred).  I prefer email to followups.

Thanx

Roger


roger binns         rdb@oasis.icl.co.uk      ICL, bracknell, uk