# Filling the arrow tip and not the path using two different colors

I have a small problem with some arrows but I can't seem to find a solution. Please note that this question is different from Setting fill color for TikZ arrow tips only (and not the path itself), since there the OP meant to make the whole arrow of one color.

If I wanted the arrow tip to be black and the arrow path to be colored, I'd simply say draw=black but I need the opposite, a black path with a colored tip.

So this is what I get:

And this is my code:

\documentclass[10pt]{article}
\usepackage[a4paper, margin=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{tikz}

\usetikzlibrary{arrows,backgrounds,decorations,shapes,shapes.multipart,positioning}
\pgfplotsset{compat=1.7}

\begin{document}

\definecolor{blue}{RGB}{0,127,255}

\tikzset{
opera/.style={fill=white, inner sep=0pt, right=3mm, text width= 5cm,font=\footnotesize},
tear/.style={draw=black, fill=blue, -*},.
}

\begin{tikzpicture}

\draw[tear] (12, 5) -- (12,4) -- (10,3) -- (10,2) node[opera] at (10,2){Not the path!};

\end{tikzpicture}
\end{document}


I've tried removing as much as possible to make the code minimal so don't worry if you see unused packages or libraries.

I've thought as a possible solution to add an option like >=stealth but trying to set the color using the o or * arrow tips. None worked.

-

the following answer is based on markings and postaction.

\documentclass[10pt]{article}
\usepackage[a4paper, margin=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{tikz}

\usetikzlibrary{arrows,backgrounds,decorations.markings,shapes,shapes.multipart,positioning}
\pgfplotsset{compat=1.7}

\begin{document}

\definecolor{blue}{RGB}{0,127,255}

\tikzset{
opera/.style={fill=white, inner sep=0pt, right=3mm, text width= 5cm,font=\footnotesize},
tear/.style={draw=black,-,
decoration={markings,mark=at position 1 with {\arrow[draw=black,fill=blue]{*}}},
postaction=decorate},.
}

\begin{tikzpicture}

\draw[tear] (12, 5) -- (12,4) -- (10,3) -- (10,2);

\end{tikzpicture}
\end{document}


which produces:

I removed the arrow head from your tear style and added decoration={markings,mark=at position 1 with {\arrow[draw=black,fill=blue]{*}}} and postaction=decorate. In this way the arrowhead is drawn as a decoration at the end of your segment, without filling the path. You also need to load the decoration as a postaction with postaction=decorate, so that only the arrow head is overwritten and not the entire line.

Edit: The previous approach is now (with the releasing of PGF 3.0.0) obsolete:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\definecolor{myblue}{RGB}{0,127,255}

\tikzset{
opera/.style={
fill=white,
inner sep=0pt,
right=3mm,
text width= 5cm,
font=\footnotesize
},
tear/.style={
-{Circle[fill=myblue]}      %new code, requires arrows.meta and at least PGF 3.0.0
},
}
\begin{document}
\begin{tikzpicture}
\draw[tear] (12, 5) -- (12,4) -- (10,3) -- (10,2) node[opera] {Not the path!};
\end{tikzpicture}
\end{document}


-
Thanks, this does the trick. :) –  Alenanno Apr 2 '13 at 20:44
you're welcome, I actually discovered some cool stuff about markings while answering :) –  dcmst Apr 2 '13 at 21:09
Ahah that's great! –  Alenanno Apr 2 '13 at 21:39