Trying to add color for shadows with shadows.blur
library, I have method which consist of modify the code of render blur shadow
, here a MWE
\documentclass[margin=2cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\makeatletter
\tikzset{render blur shadow/.code=
{\pgfbs@savebb
\pgfsyssoftpath@getcurrentpath{\pgfbs@input@path}%
\pgfbs@compute@shadow@bbox
\pgfbs@process@rounding{\pgfbs@input@path}{\pgfbs@fadepath}%
\pgfbs@apply@canvas@transform
\colorlet{pstb@shadow@color}{white!\pgfbs@opacity!violet}%
\pgfdeclarefading{shadowfading}{\pgfbs@paint@fading}%
\pgfsetfillcolor{violet}%
\pgfsetfading{shadowfading}%
{\pgftransformshift{\pgfpoint{\pgfbs@midx}{\pgfbs@midy}}}%
\pgfbs@usebbox{fill}%
\pgfbs@restorebb
},
}
\makeatother
\begin{document}
\begin{tikzpicture}
\node[fill=white, draw=black, blur shadow,font=\Large] {Node};
\end{tikzpicture}
\end{document}
The original definition of render blur shadow
is
render blur shadow/.code=
{\pgfbs@savebb
\pgfsyssoftpath@getcurrentpath{\pgfbs@input@path}%
\pgfbs@compute@shadow@bbox
\pgfbs@process@rounding{\pgfbs@input@path}{\pgfbs@fadepath}%
\pgfbs@apply@canvas@transform
\colorlet{pstb@shadow@color}{white!\pgfbs@opacity!black}%
\pgfdeclarefading{shadowfading}{\pgfbs@paint@fading}%
\pgfsetfillcolor{black}%
\pgfsetfading{shadowfading}%
{\pgftransformshift{\pgfpoint{\pgfbs@midx}{\pgfbs@midy}}}%
\pgfbs@usebbox{fill}%
\pgfbs@restorebb
}
From the above code I just want to change black
to violet
with a simple manner, I tried to use
render blur shadow/.append code=
{\colorlet{pstb@shadow@color}{white!\pgfbs@opacity!violet}%
\pgfsetfillcolor{violet}%
},
But this does not succeed, any suggestions.
Update
I meant if there is a macro like \patchcmd
from etoolbox
to change code of
render blur shadow
like this without rewriting code of render blur command
\patchcmd{render blur command}{black}{violet}{<success>}{<failure>}
Desirable code
\documentclass[margin=2cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\patchcmd{render blur command}{black}{violet}{<success>}{<failure>}
\begin{document}
\begin{tikzpicture}
\node[fill=white, draw=black, blur shadow,font=\Large] {Node};
\end{tikzpicture}
\end{document}
render blur shadow
without rewrite the entire codeblack
with#1
and userender blur shadow=violet
which might need to modify theblur shadow
too