dbTalk Databases Forums  

Fonts & Colors

comp.databases.paradox comp.databases.paradox


Discuss Fonts & Colors in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jim Moseley
 
Posts: n/a

Default Fonts & Colors - 11-10-2006 , 04:00 PM







Greetings

Is there an easy way to determine whether a uiObject's color is too dark
to use font.color=black, and instead replace it with font.color=white?

If I check each rgb() value, what would the breaking point be? Or should
I add then together (red+green+blue > x)? Or does someone have a better
solution?

Thanks,
Jim Moseley

Reply With Quote
  #2  
Old   
Liz McGuire
 
Posts: n/a

Default Re: Fonts & Colors - 11-10-2006 , 04:50 PM






That's an interesting question. I suppose you could theorize that
anything which is less than 3* 128 (384) is too dark for black.
Anything equal or greater is OK for black. That might need some
tweaking. If you have ProView, use the floating color selector to
experiment, but I expect it would hold, once you'd found the dividing
line...

Of course, colors are integers and it would probably be easier to
compare the color to an integer. 128,128,128 is 8421504. And the
integer is smaller as you get darker and larger as you get lighter, so
the same theory should hold...

FWIW,

Liz


Jim Moseley wrote:
Quote:
Greetings

Is there an easy way to determine whether a uiObject's color is too dark
to use font.color=black, and instead replace it with font.color=white?

If I check each rgb() value, what would the breaking point be? Or should
I add then together (red+green+blue > x)? Or does someone have a better
solution?

Thanks,
Jim Moseley

Reply With Quote
  #3  
Old   
Robert Molyneux
 
Posts: n/a

Default Re: Fonts & Colors - 11-10-2006 , 10:59 PM



You could maybe look at using the Windows theme colours.

These extend the standard colours, and vary depending on how the user's
theme has been set.

"Jim Moseley" <jmose (AT) mapson (DOT) attglobal.net> wrote

Quote:
Greetings

Is there an easy way to determine whether a uiObject's color is too dark
to use font.color=black, and instead replace it with font.color=white?

If I check each rgb() value, what would the breaking point be? Or should
I add then together (red+green+blue > x)? Or does someone have a better
solution?

Thanks,
Jim Moseley



Reply With Quote
  #4  
Old   
Jim Moseley
 
Posts: n/a

Default Re: Fonts & Colors - 11-13-2006 , 04:16 PM




Quote:
Is there an easy way to determine whether a uiObject's color is too dark
to use font.color=black, and instead replace it with font.color=white?

I hate to answer my own question, but I found an interesting post on another
newsgroup.

First, calculate the luminosity, which will have a range from 1 to 255.
Then use a white font if L < 127 and a black font if L >= 127. Seems to
work pretty well.

Luminosity = Red*0.3 + Green*0.59 + Blue*0.11

Somehow this is tied in with black&white TVs showing color programs! Here's
the link if anyone's interested.

Thanks,
Jim Moseley


http://groups.google.com/group/micro...45071dae108445


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.