Never mind, I couldn't find anything yesterday but found some code today
after some carefully worded googling, which appears to work well.
RGB := ColorToRGB(BackColor);
if (GetRValue(RGB) + GetGValue(RGB) + GetBValue(RGB)) > 384 then
Font.Color := clBlack
else
Font.Color := clWhite;
From: [email protected] [mailto:[email protected]] On
Behalf Of Ross Levis
Sent: Tuesday, 7 June 2011 4:06 PM
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] Auto Black or White font colour
I'm hoping someone may have a routine which determines if the font colour
should be black or white depending on the colour of the component.
I have buttons which the user can choose the colour, but black text on a
dark colour can't be seen.
Cheers.
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with Subject:
unsubscribe