Trying to solve pgf basic layer: struggling (again) with colors, I had an idea for a workaround (saving a state for circuitikz...).
But although I know how to add a hook to the color= key, TikZ let you use just the color as a synonym, and I can't find how to make it work in that case:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\tikzset{mykey/.initial=(none)}
\pgfkeys{/tikz/color/.add code={}{\tikzset{mykey={#1}}}}
\begin{document}
\begin{tikzpicture}[]
\draw[color=red] (0,1) node{I see \pgfkeysvalueof{/tikz/mykey}};
\draw[red] (0,0) node{I see \pgfkeysvalueof{/tikz/mykey}};
\end{tikzpicture}
\end{document}
Is it possible to "attach" the hook also to the second line?
BTW: I tried this:
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{etoolbox}
\tikzset{mykey/.initial=(none)}
\pgfkeys{/tikz/color/.add code={}{\tikzset{mykey={#1}}}}
\makeatletter
\apptocmd{\tikz@compat@color@set}{\tikzset{mykey={#1}}}%
{\typeout{color patching ok}}{\typeout{color patching failed}}
\makeatletter
\begin{document}
\begin{tikzpicture}[]
\draw[color=red] (0,1) node{I see \pgfkeysvalueof{/tikz/mykey}};
\draw[blue] (0,0) node{I see \pgfkeysvalueof{/tikz/mykey}};
\end{tikzpicture}
\end{document}
which is not giving error, the \tikzset is called, by it still fails (probably a scoping problem).

