Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing Background Colour with Link Colour 2

Status
Not open for further replies.

chris921

Technical User
Joined
Mar 9, 2004
Messages
82
Location
GB
Can someone tell me how to compare the background colour of a webpage with the colour of its text and links?

I would like it so that the user enters the URL of the site to be looked at into a form, and if the background roughly matches the colour of links or text, to give a warning message, otherwise to say everything is fine...

Thank you in advance,

Chris
 
Chris,

That's not going to be easy, as the background colour can set for a cell in a table by the row, column or table directives, and it can be done either in the html, or through the use of a cascading style sheet, and colours can be either literal values "red", "magenta", or RGB values (here's where your head'll melt) you'll have to go through "acceptable" contrasting values and store them in an array or a more complex structure

#000000 => #FFFFFF (these are hex values, and the good news is there's a finite amount, the bad news, still too many to build up an acceptable pallete of what goes well with what)

If you get this sorted you could be worth a few bucks as a fashion consultant

What goes well with red, ==>#FF0000, #FF00FF,#99FF00 ad infinitum -BTW this is a ramble, and I'm not implying that the colours here match, that's the job of the objective fashion guru v.v you

HTH
--Paul
 
Sorry, I think I wasnt very clear in explaining - what I was looking for is that if someones been a bit daft and not altered the colour of links that are unvisited (ie Blue) and have set a blue background...

 
as PaulTEG says ... what is blue?

<font color = #000033</font> or
<font color = #000066</font> or
<font color = #000099</font> or
<font color = blue>blah blah blah</font>


Kind Regards
Duncan
 
Chris,

I don't think what you're now specifically asking can be easily achieved

Code:
<table bgcolor=#0000FF>
  <tr bgcolor=blue>
     <td bgcolor=#oo22ff> #with or without quotes
       <a href=webcheck.htm><font color=blue>Chris's webcheeck page</font></a>
     </td>
  </tr>
</table>

Now that's an easy one, but if that's handled by .CSS (cascading stylesheet) that's another whole bucket of crapola.
--Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top