Definir el color del texto para todos los nodos tikz de un tipo particular

Definir el color del texto para todos los nodos tikz de un tipo particular

Quiero que un tipo de nodo particular en tikz tenga un color de texto específico. Actualmente, he definido una macro para el color del texto. Pero necesito seguir usando esa macro en cada nodo.

¿No existe una solución mejor? Entonces, al igual que definir el color de fondo de un nodo, ¿también podemos definir el color del texto en \tikzstylela declaración?

Aquí está el MWE:

\documentclass{article}

\usepackage[svgnames]{xcolor}                                                                                                         
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\newcommand{\whttxt}[1]{\textbf{\textcolor{LemonChiffon}{#1}}}
\begin{document}
\pagestyle{empty}

% Define block styles
\tikzstyle{block} = [rectangle, draw, fill=black, text width=5em, text centered, rounded corners, minimum height=4em]

\begin{tikzpicture}[node distance=1in]
  \node [block] (nodea) {\whttxt{Node A}};
  \node [block, below of=nodea] (nodeb) {\whttxt{Node B}};
\end{tikzpicture}

\end{document}

Respuesta1

Puede usar text=LemonChiffonla opción para especificar el color del texto junto con la font=opción para aplicar \bfseries. A continuación, reemplacé la \whttxtmacro con la whttxtopción de aplicar estos dos:

ingrese la descripción de la imagen aquí

Notas:

Código:

\documentclass{article}

\usepackage[svgnames]{xcolor}                                                                                                         
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
%\newcommand{\whttxt}[1]{\textbf{\textcolor{LemonChiffon}{#1}}}

\begin{document}
\pagestyle{empty}

% Define block styles
%\tikzstyle{block} = [rectangle, draw, fill=black, text width=5em, text centered, rounded corners, minimum height=4em]
\tikzset{block/.style={rectangle, draw, fill=black, text width=5em, text centered, rounded corners, minimum height=4em}}
\tikzset{whttxt/.style={text=LemonChiffon, font=\bfseries}}

\begin{tikzpicture}[node distance=1in]
  \node [block, whttxt] (nodea) {Node A};
  \node [block, below of=nodea, whttxt] (nodeb) {Node B};
\end{tikzpicture}

\end{document}

información relacionada