I would like to set a drawing option to decorate lines with a circle of a color of my choice, with "none" meaning no circle. I am hoping for something like this:
\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{positioning, decorations.markings}
\tikzset{-o-/.style n args={1}{
append after command={\pgfextra{\let\mainnode=\tikzlastnode}% Borrowed this line, but I don't understand it.
\def\argone{#1} \def\argtwo{none}
\ifx\argone\argtwo
\else
decoration={markings, mark=at position 0.5 with {draw[black, fill=#1] circle[radius=2pt];}}, postaction={decorate}
\fi
}}}
\newcommand*{\mytriangle}[1]{
\begin{tikzpicture}
\draw[-o-={#1}] (0,0)--(0,1);
\draw[-o-={#1}] (0,0)--(1,0);
\draw[-o-={#1}] (1,0)--(0,1);
\end{tikzpicture}}
\begin{document}
\mytriangle{white}, \mytriangle{none}.
\end{document}
I tried to borrow
append after command={\pgfextra{...} ...}
from this question, since otherwise ifx conditional does not work inside of \tikzset, but now my code does not make the desired decorations.

\mytriangleinstead of\tikzset? – NBur Jan 11 '21 at 07:51