bgcolor help

wxdqz

New Member
Hi -- I am trying to make a page on which the background color is randomly chosen everytime the page is loaded. In and of it self, that isn't so bad -- I have that code. However, that code only randomizes the background. So, occasionally, the text is lost because it remains static. I have 2 solutions but don't know how to code either one and would appreciate any help:
1. Is there a constant which, when added, subtracted multiplied or somehow incorporated into on hex color code, results in the opposite (thus ensuring contrast)? Then, text color could be bgcolor + constant.

2. Is there a way to make text color conditional based on the bgcolor value? Is there a "halfway point" in hex addresses, above which would adopt a block text, below which, a white text? Are there ranges so I can set up a series of conditions?

Thanks
Dan
 
Back
Top