Setting text color in TikZ without changing line color; conflict with double

You should set the color using text=red instead of color=red:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}

\tikzset{curveinscope/.style={every path/.style={draw=white, double distance=1pt, line width=2pt, double=red, text=red}}}

\begin{scope}[curveinscope]
\node at (1,0) {X};
\draw (0,0) -- (2,2);
\draw (2,1) -- (0,1);
\end{scope}

\end{tikzpicture}
\end{document}


Separate your path-specific options from your node-specific ones. Put the node-specific ones in an every node/.style:

\documentclass{standalone}
\usepackage{tikz}
\tikzset{curve in scope/.style={
    every path/.style={
      draw=white,
      double distance=1pt,
      line width=2pt,
      double=red,
    },
    every node/.style={
      color=red
    }
  },
  curve in scope with bad colours/.style={
    every path/.style={
      draw=white,
      double distance=1pt,
      line width=2pt,
      double=red,
      color=red
    }
  }
}
\begin{document}
\begin{tikzpicture}
\begin{scope}[curve in scope]
\path (0,0) -- node[auto] {hello world} (3,0);
\end{scope}
\begin{scope}[curve in scope with bad colours,yshift=-1cm]
\path (0,0) -- node[auto] {hello world} (3,0);
\end{scope}
\end{tikzpicture}
\end{document}

Result:

colours on paths and nodes

Tags:

Color

Tikz Pgf