I am trying to draw colored lines with a foreach loop. The command I use to draw the line creates a colored line if I use it standalone. Once I put it inside the foreach loop, I only get a black line. How do I draw colored lines inside a foreach loop?
\documentclass{report}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[lengthMark/.style={<->}]
\foreach \i/\color in {0/{violet!50},1/yellow} {
\draw[\color] (3.5, -.25-\i) -- ++(.5, 0);
\draw[red] (0,0) --(2,2);
}
\draw[red] (0,0) --(2,-2);
\end{tikzpicture}
\end{document}
write latex, note while posting it only the line drawn outside the foreach (\draw[red] (0,0) --(2,-2);) appears colored.

\coloris an important macro forxcolor. And inside\foreachyou overwrite it. I've changed it to\mycolorin writelatex. Can you confirm if that is what you want? – percusse Sep 03 '13 at 22:03