I am trying to create a custom postnote in a citation for a project where I need to subtly highlight some citations. I would like to draw two semicircles, filled with different colors, and display this as a postnote next to a citation. Below is a MWE of what I am trying:
\documentclass[a4paper,BCOR=0mm,DIV=18]{scrartcl}
\usepackage{xcolor}
\definecolor{mygreen}{rgb}{0.106,0.62,0.467}
\definecolor{myorange}{rgb}{0.851,0.373,0.008}
\usepackage[backend=biber]{biblatex}
\addbibresource{temp.bib}
\usepackage{tikz}
\usetikzlibrary{positioning}
\newcommand{\mix}{{
\begin{tikzpicture}
\begin{scope}
\clip (0,-0.5ex) rectangle (0.5ex,0.5ex);
\fill[myorange] (0,0) circle(0.5ex);
\draw[myorange] (0,-0.5ex) -- (0,0.5ex);
\end{scope}
\begin{scope}
\clip (0,0.5ex) rectangle (-0.5ex,-0.5ex);
\fill[mygreen] (0,0) circle(0.5ex);
\end{scope}
\end{tikzpicture}}}
\begin{document}
Why does this citation \cite[\mix]{ref} not work? % comment to get it to run
But this \mix works?
\end{document}
and the bibliography file:
@article{ref,
title = {blah blah},
journaltitle = {Journal},
}
When I put \mix outside the \cite command everything works fine, but once I put use it as a postnote I get undefined control sequence errors all over the show... Does anybody know how I can fix this?

\newsavebox{\mix} \savebox{\mix}{<tikzpicture>},\cite[\usebox{\mix}]{ref}. – Jasper Habicht Oct 04 '22 at 22:15