FrançaisEnglishEspañol
PC SOFTForums homeLast messagesOnline repository
PC SOFT
Find...
Perform the searchSearch in...
Newsgroup dedicated to WINDEV (current version), in English
Color + Background color / inverse colors
Oct., 30th 2009 at 11:15 AM
Jimbo
<gu...st@news.pcsoft.fr>

Message 1/4
Color + Background color / inverse colors

Hi,
there are the 24 standard colors in WinDev, these correspond to integer values describing the color. Putting the colors for selection as background-color into a combo (use: gBackground) is easy, the problem is readability of the forground text. e.g. black text on black background - no good.
In order to get readable rows in the combo I just inverted the text-colors in gPen(..) like here
FOR i = 1 TO 24
ListAdd(MySelf,gBackground(StdColor)+gPen(16777215 - StdColor)+StdColorName+gLink(StdColor))
END


For most colors more or less it does work, but it definitely doesn't work with DarkGray - because this color is mirroring axis for color inversion.
Question: is there a simple formula which makes the text readable in each and every case of the background color??
Kind regards,
Guenter


Oct., 30th 2009 at 11:51 AM
Fabrice Harari
<fr...eb@fabriceharari.com>

Message 2/4
Re: Color + Background color / inverse colors

Hi Guenter

there are numerous answers to that question when you type "calculate
contrasting color values" in google, the first interesting one being:
http://particletree.com/notebook/calculating-color-contrast-for-legible-text/

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Jimbo wrote:
Hi,
there are the 24 standard colors in WinDev, these correspond to integer values describing the color. Putting the colors for selection as background-color into a combo (use: gBackground) is easy, the problem is readability of the forground text. e.g. black text on black background - no good.
In order to get readable rows in the combo I just inverted the text-colors in gPen(..) like here
FOR i = 1 TO 24
ListAdd(MySelf,gBackground(StdColor)+gPen(16777215 - StdColor)+StdColorName+gLink(StdColor))
END


For most colors more or less it does work, but it definitely doesn't work with DarkGray - because this color is mirroring axis for color inversion.
Question: is there a simple formula which makes the text readable in each and every case of the background color??
Kind regards,
Guenter







Oct., 30th 2009 at 08:00 PM
Jimbo
<gu...st@news.pcsoft.fr>

Message 3/4
Re: Color + Background color / inverse colors

Hi Fabrice,
this seems to be a non-trivial task though there are some simpler solutions to be found. I'll have to dig into this a bit more. Maybe, I'll make demo project, in case of success only, of course.
Thanks!
Kind regards,
Guenter


Nov., 02nd 2009 at 00:14 AM
Jimbo
<gu...st@news.pcsoft.fr>

Message 4/4
Re: Color + Background color / inverse colors

Hi friends,
I'm done with a demo project for this problem which may be of interest for web designers too!
See item 6 in
http://www.windev.at/html/downloads.html
Kind regards,
Guenter