Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determine Contrasting/Inverse Colors
Message
De
23/05/2009 12:40:16
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
22/05/2009 19:41:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01401618
Message ID:
01401660
Vues:
57
This message has been marked as a message which has helped to the initial question of the thread.
>I need to be able to determine the forecolor when a user selects the backcolor. This is to be able to display the text as readable based on what the backcolor is. Just taking the inverse color works for the outer color spectrum but when it is in the middle this does not work well.
>
>Does anyone have any ideas on how to calculate the best readable forecolor based on the backcolor setting? Thanks.

Inverse color is the easiest thing to do: bitxor(nColor, 0xffffff), but the inverse of #808080 is #7f7f7f, which looks pretty much the same. IOW, any color that's close to the middle (and #808080 and #7f7f7f aren't colors at all - they are grays) will have an inverse that's just as close to the middle, and the distance between such a color and its inverse in the color space may fall below any readability standard.

So if the solution that Tracy posted looks like a cheap way out (the result is again not a color, but a black or a white), it's actually the best way out. In many cases you actually don't want the contrary color, because it would wear and (literally?) tear the eyes of the user. While it may help some of them, it may irritate others. So I'd go with that simple black and white answer to this color question.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform