This question is very similar to this question. I additionally need to be able to colour the second half of the node in any other color, preferrably via another pgf-Argument. I tried different approaches, all modifying the code below, but every single one failed in different ways. Could somebody enlighten me?
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{calc}
\makeatletter
\tikzset{
prefix after node/.style={
prefix after command={\pgfextra{#1}}
},
/semifill/ang/.store in=\semi@ang,
/semifill/ang=0,
semifill/.style={
circle, draw,
prefix after node={
\typeout{aaa \semi@ang}
\let\nodename\tikz@last@fig@name
\fill[/semifill/.cd, /semifill/.search also={/tikz}, #1]
let \p1 = (\nodename.north), \p2 = (\nodename.center) in
let \n1 = {\y1 - \y2} in
(\nodename.\semi@ang) arc [radius=\n1, start angle=\semi@ang, delta angle=180];
},
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\node[semifill={gray,ang=60}] {$y$};
\end{tikzpicture}
\end{document}


path pictureoption. – muzimuzhi Z Jul 18 '22 at 19:59