Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding contrasting colors
Message
 
 
To
23/10/2002 17:26:08
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00714574
Message ID:
00714643
Views:
27
Oscar,

Use RGBColor() to decompose a color into its R, G and B values. If the value is less than 128 it's "dark", greater that 128 it's "light". You might then try adding all three together nTotal = nRed + nGreen + nBblue and if the total is less than 3*128 use white background and black otherwise.

>I need to make the text readable no matter the back color. I tried setting dynamicforecolor to bitxor(dynamicbackcolor, rgb(255,255,255)), but the results are disgusting
>
>I want to set dynamicforecolor to black if the back color is light and to white if the back color is dark. But I cannot find a function that reliably tells me the "intensity" or "luminance" of the color...
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform