x_terminat_or_3
asked on
calculate contrast of two colors
Hi all
I would like to include a warning in our product when a user picks a background color that is not contrasting enough with the foreground color. Like say, cream on white background? Or red on maroon background?
We only work with colors by there hex values, valid color notations are: #+hex string <=6 chars, obviouslly padded with zerros for the missing values, and adhering to the standard of #rrggbb
So how would I do it? Compare the colors based on their decimal value and define a minimum treshold? Do so for each of the colors (r, g, b)?
Any suggestions, or real life experience?
Thanks
Ramses aka x_terminat_or_3
I would like to include a warning in our product when a user picks a background color that is not contrasting enough with the foreground color. Like say, cream on white background? Or red on maroon background?
We only work with colors by there hex values, valid color notations are: #+hex string <=6 chars, obviouslly padded with zerros for the missing values, and adhering to the standard of #rrggbb
So how would I do it? Compare the colors based on their decimal value and define a minimum treshold? Do so for each of the colors (r, g, b)?
Any suggestions, or real life experience?
Thanks
Ramses aka x_terminat_or_3
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.