You can specify the fill opacity
separately from the draw opacity
. In the first example below I used opacity
and in the second I used fill opacity
which will only affect the fill
and not the draw
.

Note:
- As pointed out by Martin Scharrer: Specifying
\opacity=<x>
affects the fill
, draw
and text
so is equivalent to saying fill opacity=<X>, draw opacity=<X>, text opacity=<X>
.
fill opacity
applies not only to the fill, but also applies to text. To override this behavior, you can separately set the text opacity
which applies only to the text labels. So, apply text opacity=1
to ensure that opacity is not applied to the text.
Code:
\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw [ultra thick, draw=black, fill=yellow, opacity=0.2]
(0,0) -- (0,1) -- (1,1) -- cycle;
\end{tikzpicture}
\begin{tikzpicture}
\draw [ultra thick, draw=black, fill=yellow, fill opacity=0.2]
(0,0) -- (0,1) -- (1,1) -- cycle;
\end{tikzpicture}
\end{document}