esteel wrote:Hmm i have no idea how you will do the thing but remeber that you can toggle between two values quite easily by subtracting the current value from the sum of the two..
Exampe: values 7 and 9 (sum = 16), current = 7..
current = 16 - current (7) = 9.. use 9 as color
current = 16 - current (9) = 7.. use 7 as color
current = 16 - current (7) = 9.. use 9 as color
and so on..
Inside a loop, this is as effective as it gets:
- Code: Select all
if ($curcolor == "#444444") $curcolor = "#888888";
else $curcolor = "#444444";
print $curcolor;
edit:
Yeas, i'm a self-thaught, real-life coder. That means I make things that works, and is effective, not necessarily the way a school teacher would do it

Edit2:
of cource you can exchange the color codes with CSS classes, a single number or whatever differentiates the colors.