I have the following minimal example:
\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = 1.12}
\pgfplotsset{
every axis/.style = {
colormap name = viridis,
},
}
\tikzset{
cmapfill/.style = {
color of colormap = {#1},
draw = .!50!black,
% text = .!50!black,
fill = .!25!white,
},
}
\begin{document}
\begin{tikzpicture}
\node[cmapfill = 200] (x) at (0, 0) {$x$};
\node[cmapfill = 700] (y) at (1, 0) {$y$};
\end{tikzpicture}
\end{document}
This works nicely, except that the text in the nodes has the color of the colormap, and I would like it to have the darker color .!50!black just like the border.
If I uncomment the text = .!50!black line then the text indeed has the desired color, however the string !50!black appears in the labels too.
How can I avoid changing the label text, but still change the text color?


.is not understood by TikZ but it uses it internally because that's whatxcolorunderstands. It's not meant for end user. – percusse Feb 15 '18 at 11:59#1is not a color, it is the progress of the colormap. If I replace.with#1I getPackage xcolor Error: Undefined color '200'. – Ruud Feb 15 '18 at 12:42.was suggested in this answer. If it is not intended for users, what should I use instead? – Ruud Feb 15 '18 at 12:43textand path colors.` – percusse Feb 15 '18 at 12:47