Hang on..

Yep I just tested it.

Make sure you incldue the forward slash REGEX seperators in those preg

Ie.. my lines in previous email have:

Which should be:

----- Original Message -----
From: "::[ Julien Bonastre ]::" <[EMAIL PROTECTED]>
Sent: Wednesday, October 09, 2002 11:59 PM
Subject: Re: [PHP] Reversing the Colour.

- background colour is stored in $bgcol (ie 4592FF)
- chosen link colour is stored in $lncol (ie *same as above*)
- Finds "half-way" colour between $bgcol and $lncol (returns a RRGGBB in hex
as above)

This is actually fairly simple Alexis.. Simply convert your hex vals to
something you can work with (ie dec) using hexdec() and then do some basic
maths to find the half way between each of the R G B vals and then finally
spitting out a hex value for the midway mark..


/** Func: getMidColour **/
// Returns the midway value in HEX between the two DEC values $dec1, $dec2
function getMidColour(&$dec1,&$dec2) {

// Parses 6char hex colour (RRGGBB) into 3 part RGB string and feeds into an

// We now can access the hex RGB values through the [0],[1],[2] elements of
these arrays..
// Using our custom function we can throw into our final array the actual 3
hex values
// desired which is the midpoint between $bgcol and $lncol


HIH.. Not tested.. Please tell me how it goes (if it goes :-p)


----- Original Message -----
From: "Alexis Antonakis" <[EMAIL PROTECTED]>
To: "Php-General@Lists. Php. Net" <[EMAIL PROTECTED]>
Sent: Wednesday, October 09, 2002 10:48 PM
Subject: [PHP] Reversing the Colour.

> Hi,
> I have a site whereby the user can select the colour of links for their
> individual sections.
> What I would like to do is to get the exact opposite colour of the one
> they choose and use that in the 'hover over' option of the <a> tag.
> The value for the colour is stored in hex.
> To add to this, the user can also choose the background colour. I have
> sure that they cannot have the same background colour as colour of the
> but obviously if the background colour is the exact opposite of the link
> colour, then when they hover over the link, it would 'disappear'. In this
> case I would like to choose HALFWAY between the two sets of colours. I
> that this might not always produce the best colour combinations, but I'm
> trying to get it so that the links always 'stand out'. I cannot let them
> choose the colour of the 'Hover Over' option unfortunately.
> Any suggestions as to how to achieve this, especially the calculations, or
> for that matter improve upon it, would be most appreciated.
> Regards
> Alexis
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to