|
Posted by trlists on 04/16/05 06:48
On 16 Apr 2005 Ryan A wrote:
> eg: if they pick white I need the heading to be black and vice
> versa...any way to do this?
Well it depends what you mean by "opposite", but as a starting approach
I would try simply complementing the bits in the RGB value:
$opposite_color = $original_color ^ 0xFFFFFF;
This will yield, for example, all of the following, and their
inverses:
#000000 => #FFFFFF (black => white)
#FF0000 => #00FFFF (red => cyan)
#00FF00 => #FF00FF (green => magenta)
#0000FF => #FFFF00 (blue => yellow)
--
Tom
Navigation:
[Reply to this message]
|