# Strange border appears with a \fill with inner/outer color options

I'd like to have a radial shaded circle whose outer color is the same as the background, but I didn't manage to do it.

If I set outer color=white without a background, a strange border appers (see Figure 1).

If I set the outer color equal to a background color, they are different in the output (see Figure 2).

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\fill[even odd rule,inner color=red,outer color=white] (0,0) circle (3);
\end{tikzpicture}
\caption{How to get rid of the thin border here?}
\end{figure}
\begin{figure}
\centering
\begin{tikzpicture}
\fill[cyan] (-4,-4) rectangle (4,4);
\fill[even odd rule,inner color=red,outer color=cyan] (0,0) circle (3);
\end{tikzpicture}
\caption{How to make the outer color equal to the background here?}
\end{figure}
\end{document}


In the two cases, you don't need to fill your circle before to shade it. So, use \path or \shade instead of \fill.

The second case uses colors from two different models: red (rgb) and cyan (hsv). But, with TikZ/pgf, shading always uses rgb colors. So, convert the cyan color to rgb before to use it.

\documentclass{article}
\usepackage{tikz}
\colorlet{cyan}[rgb]{cyan}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\shade[even odd rule,inner color=red,outer color=white] (0,0) circle (3);
\end{tikzpicture}
\caption{How to get rid of the thin border here?}
\end{figure}
\begin{figure}
\centering
\begin{tikzpicture}
\fill[cyan] (-4,-4) rectangle (4,4);
\path[even odd rule,inner color=red,outer color=cyan] (0,0) circle (3);
\end{tikzpicture}
\caption{How to make the outer color equal to the background here?}
\end{figure}
\end{document}